Skip to content

Commit 44d8ead

Browse files
committed
fix logic errors
1 parent d43e38b commit 44d8ead

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

dicom_filter.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pflog import pflog
1111
from pydicom.pixel_data_handlers import convert_color_space
1212
import numpy as np
13-
__version__ = '1.2.4'
13+
__version__ = '1.2.5'
1414

1515
DISPLAY_TITLE = r"""
1616
_ _ _ __ _ _ _
@@ -134,24 +134,24 @@ def read_input_dicom(input_file_path, filters, exclude):
134134

135135
for key, value in d_filter.items():
136136
try:
137-
if value in str(ds.data_element(key)) and not exclude:
137+
print(f"expected: {value} found: {ds.data_element(key)} exclude: {exclude} \n")
138+
if value in str(ds.data_element(key)):
138139
continue
139140
else:
140-
print(f"expected: {value} found: {ds.data_element(key)} exclude: {exclude} \n")
141141
if exclude:
142142
return ds
143-
else:
144-
print(f"file: {input_file_path.name} doesn't match filter criteria")
145-
return None
146-
except Exception as ex:
147-
if exclude:
148-
return ds
149-
else:
150-
print(f"Exception : {ex}")
143+
print(f"file: {input_file_path.name} doesn't match filter criteria")
151144
return None
145+
except Exception as ex:
146+
print(f"Exception : {ex}")
147+
return None
152148

149+
if exclude:
150+
print(f"file: {input_file_path.name} matches filter criteria")
151+
return None
153152
return ds
154153

154+
155155
def save_dicom(dicom_file, output_path):
156156
"""
157157
Save a dicom file to an output path

0 commit comments

Comments
 (0)