|
10 | 10 | from pflog import pflog |
11 | 11 | from pydicom.pixel_data_handlers import convert_color_space |
12 | 12 | import numpy as np |
13 | | -__version__ = '1.2.5' |
| 13 | +__version__ = '1.2.6' |
14 | 14 |
|
15 | 15 | DISPLAY_TITLE = r""" |
16 | 16 | _ _ _ __ _ _ _ |
@@ -73,13 +73,6 @@ def main(options: Namespace, inputdir: Path, outputdir: Path): |
73 | 73 |
|
74 | 74 | print(DISPLAY_TITLE) |
75 | 75 |
|
76 | | - # Typically it's easier to think of programs as operating on individual files |
77 | | - # rather than directories. The helper functions provided by a ``PathMapper`` |
78 | | - # object make it easy to discover input files and write to output files inside |
79 | | - # the given paths. |
80 | | - # |
81 | | - # Refer to the documentation for more options, examples, and advanced uses e.g. |
82 | | - # adding a progress bar and parallelism. |
83 | 76 | mapper = PathMapper.file_mapper(inputdir, outputdir, glob=f"**/*.{options.fileFilter}",fail_if_empty=False) |
84 | 77 | for input_file, output_file in mapper: |
85 | 78 | # Read each input file from the input directory that matches the input filter specified |
@@ -128,14 +121,18 @@ def read_input_dicom(input_file_path, filters, exclude): |
128 | 121 | try: |
129 | 122 | print(f"Reading input file : {input_file_path.name}") |
130 | 123 | ds = dicom.dcmread(str(input_file_path)) |
| 124 | + if 'PixelData' not in ds: |
| 125 | + print("No pixel data in this DICOM.") |
| 126 | + return None |
| 127 | + |
131 | 128 | except Exception as ex: |
132 | 129 | print(f"unable to read dicom file: {ex} \n") |
133 | 130 | return None |
134 | 131 |
|
135 | 132 | for key, value in d_filter.items(): |
136 | 133 | try: |
137 | 134 | print(f"expected: {value} found: {ds.data_element(key)} exclude: {exclude} \n") |
138 | | - if value in str(ds.data_element(key)): |
| 135 | + if any(v in str(ds.data_element(key)) for v in value.split("/")): |
139 | 136 | continue |
140 | 137 | else: |
141 | 138 | if exclude: |
|
0 commit comments