Skip to content

Commit 7d77089

Browse files
committed
allow multiple header values
1 parent 44d8ead commit 7d77089

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY requirements.txt .
1414
RUN pip install -r requirements.txt
1515
RUN apt-get update
1616
RUN apt-get install ffmpeg libsm6 libxext6 -y
17+
RUN apt-get install tesseract-ocr -y
1718

1819
COPY . .
1920
ARG extras_require=none

dicom_filter.py

Lines changed: 6 additions & 9 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.5'
13+
__version__ = '1.2.6'
1414

1515
DISPLAY_TITLE = r"""
1616
_ _ _ __ _ _ _
@@ -73,13 +73,6 @@ def main(options: Namespace, inputdir: Path, outputdir: Path):
7373

7474
print(DISPLAY_TITLE)
7575

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.
8376
mapper = PathMapper.file_mapper(inputdir, outputdir, glob=f"**/*.{options.fileFilter}",fail_if_empty=False)
8477
for input_file, output_file in mapper:
8578
# 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):
128121
try:
129122
print(f"Reading input file : {input_file_path.name}")
130123
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+
131128
except Exception as ex:
132129
print(f"unable to read dicom file: {ex} \n")
133130
return None
134131

135132
for key, value in d_filter.items():
136133
try:
137134
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("/")):
139136
continue
140137
else:
141138
if exclude:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ pftel-client~=1.0.6
66
# for bug fix on transfer syntax errors
77
pylibjpeg
88
pylibjpeg-libjpeg
9-
python-gdcm
9+
python-gdcm

0 commit comments

Comments
 (0)