pydicom.fileset.RecordNode¶
- class pydicom.fileset.RecordNode(record: Dataset | None = None)[source]¶
Representation of a DICOMDIR’s directory record.
- children¶
The current node’s child nodes (if any)
- Type:
list of RecordNode
- instance¶
If the current node is a leaf node, a
FileInstance
for the corresponding SOP Instance.- Type:
FileInstance or None
- __init__(record: Dataset | None = None) None [source]¶
Create a new
RecordNode
.- Parameters:
record (pydicom.dataset.Dataset, optional) – A Directory Record Sequence’s directory record.
Methods
__init__
([record])Create a new
RecordNode
.add
(leaf)Add a leaf to the tree.
prettify
([indent_char])Return the tree structure as a list of pretty strings, starting at the current node (unless the current node is the root node).
remove
(node)Remove a leaf from the tree
reverse
()Yield nodes up to the level below the tree's root node.
Attributes
Return a list of the current node's ancestors, ordered from nearest to furthest.
Return a File ID component as
str
for the current node.Return the number of nodes to the level below the tree root
Return the tree's
FileSet
.Return
True
if the current node corresponds to an instance.Return the index of the current node amongst its siblings.
Return
True
if the current node is the tree's root node.Return a unique key for the node's record as
str
.Return the node after the current one (if any), or
None
.Return the current node's parent (if it has one).
Return the node before the current one (if any), or
None
.Return the record's Directory Record Type as
str
.Return the tree's root node.
- add(leaf: RecordNode) None [source]¶
Add a leaf to the tree.
- Parameters:
leaf (pydicom.fileset.RecordNode) – A leaf node (i.e. one with a
FileInstance
) to be added to the tree (if not already present).
- property ancestors: list[RecordNode]¶
Return a list of the current node’s ancestors, ordered from nearest to furthest.
- property next: RecordNode | None¶
Return the node after the current one (if any), or
None
.
- property parent: RecordNode¶
Return the current node’s parent (if it has one).
- prettify(indent_char: str = ' ') list[str] [source]¶
Return the tree structure as a list of pretty strings, starting at the current node (unless the current node is the root node).
- Parameters:
indent_char (str, optional) – The characters to use to indent each level of the tree.
- property previous: RecordNode | None¶
Return the node before the current one (if any), or
None
.
- remove(node: RecordNode) None [source]¶
Remove a leaf from the tree
- Parameters:
node (pydicom.fileset.RecordNode) – The leaf node (i.e. one with a
FileInstance
) to remove.
- reverse() Iterable[RecordNode] [source]¶
Yield nodes up to the level below the tree’s root node.
- property root: RecordNode¶
Return the tree’s root node.