IODSpecPrinter
dcmspec.iod_spec_printer.IODSpecPrinter
Bases: SpecPrinter
Printer for DICOM IOD specification models with mixed node types.
Overrides print_table to display IOD Modules nodes as a one-cell title row (spanning all columns) The table columns are those of the Module Attributes nodes.
Source code in src/dcmspec/iod_spec_printer.py
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 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 246 247 248 249 250 251 252 253 254 | |
print_csv(colorize=False)
Print the specification model as CSV to the console or file, with module title rows.
Traverses the content tree and prints each node's attributes in CSV format, with column headers from the metadata node. Optionally colorizes rows.
| PARAMETER | DESCRIPTION |
|---|---|
colorize
|
Whether to colorize the output by node depth. Ignored when writing to file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
None |
Source code in src/dcmspec/iod_spec_printer.py
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 | |
print_table(column_widths=None, colorize=False)
Print the specification model as a flat table with module title rows.
| PARAMETER | DESCRIPTION |
|---|---|
column_widths
|
List of widths for each column's content.
These widths do not include borders or padding added by Rich.
If provided, each column will be set to the specified content width.
If None, all columns default to width 20.
TYPE:
|
colorize
|
Whether to colorize the output by node depth.
TYPE:
|
Source code in src/dcmspec/iod_spec_printer.py
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 | |
print_tree(attr_names=None, attr_widths=None, colorize=False)
Print the specification model as a hierarchical tree to the console or file.
| PARAMETER | DESCRIPTION |
|---|---|
attr_names
|
Attribute name(s) to display for each node.
TYPE:
|
attr_widths
|
List of widths for each attribute in attr_names.
TYPE:
|
colorize
|
Whether to colorize the output by node depth. Ignored when writing to file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
None |
Source code in src/dcmspec/iod_spec_printer.py
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 | |
print_xlsx(column_widths=None, colorize=False)
Print the specification model to an OOXML format Excel (.xlsx) file.
Traverses the content tree and writes each node's attributes into an Excel sheet, with column headers from the metadata node. Handles newlines and applies background colorization using the same color scheme as console output (LEVEL_COLORS and SPECIAL_COLORS). Each module in the IOD is written to a separate worksheet, named after the module, and attribute rows for each module are written to their corresponding worksheet.
| PARAMETER | DESCRIPTION |
|---|---|
column_widths
|
Optional list of column widths for Excel columns.
TYPE:
|
colorize
|
Whether to apply color styling to cell backgrounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
None |
Source code in src/dcmspec/iod_spec_printer.py
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 | |