pydicom.fileset.RecordNode¶
-
class
pydicom.fileset.
RecordNode
(record: Optional[pydicom.dataset.Dataset] = 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: Optional[pydicom.dataset.Dataset] = 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: pydicom.fileset.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
¶ Return a list of the current node’s ancestors, ordered from nearest to furthest.
-
property
depth
¶ Return the number of nodes to the level below the tree root
-
property
has_instance
¶ Return
True
if the current node corresponds to an instance.
-
property
index
¶ Return the index of the current node amongst its siblings.
-
property
is_root
¶ Return
True
if the current node is the tree’s root node.
-
property
next
¶ Return the node after the current one (if any), or
None
.
-
property
parent
¶ 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
¶ Return the node before the current one (if any), or
None
.
-
remove
(node: pydicom.fileset.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
() → Generator[pydicom.fileset.RecordNode, None, None][source]¶ Yield nodes up to the level below the tree’s root node.
-
property
root
¶ Return the tree’s root node.
-