dicomtrolley.parsing¶
Models parsing things into study/series/instance structure
DICOMObjectTree
¶
For querying, adding and modifying collections of DICOM objects
Serves a different purpose from parsing.TreeNode. parsing.TreeNode is meant to build internally coherent(with parents, children) DICOMObjects from raw input. DICOMObjectTree allows manipulating these objects when they have already been created
Notes¶
If series or instances are added to the store, parent study or series will be created and added automatically.
Source code in dicomtrolley/parsing.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
add_study(study)
¶
Add given study to tree, overwriting exiting
Source code in dicomtrolley/parsing.py
215 216 217 | |
retrieve(reference)
¶
Retrieve data for the given study, series or instance from tree
Raises¶
DICOMObjectNotFound If data for the given parameters does not exist in tree
Source code in dicomtrolley/parsing.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
DICOMParseTree
¶
Models study/series/instance as a tree. Allows arbitrary branch insertions
Source code in dicomtrolley/parsing.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
__init__(root=None, allow_overwrite=False)
¶
Parameters¶
root: TreeNode, optional Root node. Will contain all. Defaults to empty allow_overwrite: bool, optional If False, will raise exception when overwriting any TreeNode.data, Defaults to False
Source code in dicomtrolley/parsing.py
31 32 33 34 35 36 37 38 39 40 41 42 43 | |
as_studies()
¶
Tree as DICOMObject instances: Study containing Series, Instance
Source code in dicomtrolley/parsing.py
179 180 181 182 | |
as_study(study_node_in)
staticmethod
¶
Tree node at the study level into a Study containing Series, Instances
Source code in dicomtrolley/parsing.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
init_from_objects(objects)
classmethod
¶
Create a tree from given objects. Useful for augmenting query results
Notes¶
Parent objects for instances and series will be created to ensure all nodes are connected to the tree root. For example, running this method with only a single instance as input will result in a regular root->study->series->instance tree. This is possible because all DICOMObjects maintain links to their parent objects
Returns¶
DICOMParseTree
Source code in dicomtrolley/parsing.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
insert(data, study_uid, series_uid=None, instance_uid=None)
¶
Insert data at the given level in tree. Will complain about missing branches
Raises¶
DICOMTrolleyError If inserting fails for any reason
Source code in dicomtrolley/parsing.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
insert_dicom_object(dicom_object)
¶
Insert dicomtrolley dicom object
Source code in dicomtrolley/parsing.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
update(other)
¶
Add all nodes in other to this tree. Overwrite existing
Parameters¶
other: DICOMObject Dicom object to add to this tree
Source code in dicomtrolley/parsing.py
68 69 70 71 72 73 74 75 76 77 | |
flatten(dicom_object)
¶
All nodes and as a flat list, study, series
Source code in dicomtrolley/parsing.py
20 21 22 23 24 25 | |