IODSpecBuilder
dcmspec.iod_spec_builder.IODSpecBuilder
Orchestrates the construction of a expanded DICOM IOD specification model.
The IODSpecBuilder uses a factory to build the IOD Modules model and, for each referenced module, uses a (possibly different) factory to build and cache the Module models. It then assembles a new model with the IOD nodes and their referenced module nodes as children, and caches the expanded model.
Source code in src/dcmspec/iod_spec_builder.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
__init__(iod_factory=None, module_factory=None, logger=None)
Initialize the IODSpecBuilder.
If no factory is provided, a default SpecFactory is used for both IOD and module models.
PARAMETER | DESCRIPTION |
---|---|
iod_factory
|
Factory for building the IOD model. If None, uses SpecFactory().
TYPE:
|
module_factory
|
Factory for building module models. If None, uses iod_factory.
TYPE:
|
logger
|
Logger instance to use. If None, a default logger is created.
TYPE:
|
The builder is initialized with factories for the IOD and module models. By default, the same factory is used for both, but a different factory can be provided for modules if needed.
Source code in src/dcmspec/iod_spec_builder.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
build_from_url(url, cache_file_name, table_id, force_download=False, json_file_name=None, **kwargs)
Build and cache a DICOM IOD specification model from a URL.
This method orchestrates the full workflow: - Loads or downloads the IOD table and builds/caches the IOD model using the iod_factory. - Finds all nodes in the IOD model with a "ref" attribute, indicating a referenced module. - For each referenced module, loads or parses and caches the module model using the module_factory. - Assembles a new expanded model, where each IOD node has its referenced module's content node as a child. - Uses the first module's metadata header and version for the expanded model's metadata. - Caches the expanded model if a json_file_name is provided.
PARAMETER | DESCRIPTION |
---|---|
url
|
The URL to download the input file from.
TYPE:
|
cache_file_name
|
Filename of the cached input file.
TYPE:
|
table_id
|
The ID of the IOD table to parse.
TYPE:
|
force_download
|
If True, always download the input file and generate the model even if cached.
TYPE:
|
json_file_name
|
Filename to save the cached expanded JSON model.
TYPE:
|
**kwargs
|
Additional arguments for model construction.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
SpecModel
|
The expanded model with IOD and module content.
TYPE:
|
Source code in src/dcmspec/iod_spec_builder.py
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 |
|