Skip to content

Commit 376ccc6

Browse files
authored
Merge pull request #31 from DIAGNijmegen/verify_dicom_filenames-bugfix
Verify DICOM filenames bugfix
2 parents 069479f + 5b9d9a6 commit 376ccc6

File tree

23 files changed

+120
-4
lines changed

23 files changed

+120
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
long_description = fh.read()
66

77
setuptools.setup(
8-
version='2.1.1',
8+
version='2.1.2',
99
author_email='[email protected]',
1010
long_description=long_description,
1111
long_description_content_type="text/markdown",

src/picai_prep/dcm2mha.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,10 @@ def process_and_write(self, output_dir: Path):
289289
if dst_path.exists():
290290
serie.write_log(f'Skipped "{mapping}", already exists: {dst_path}')
291291
skips.append(i)
292+
continue
292293

293294
try:
294-
image = DICOMImageReader(serie.path).image
295+
image = DICOMImageReader(serie.path, verify_dicom_filenames=self.settings.verify_dicom_filenames).image
295296
except Exception as e:
296297
serie.write_log(
297298
f'Skipped "{mapping}", reading DICOM sequence failed, maybe corrupt data? Error: {e}')
@@ -492,7 +493,8 @@ def __init__(self, path: PathLike, verify_dicom_filenames: bool = True):
492493
for name in zf.namelist()
493494
if name.endswith(".dcm")
494495
]
495-
self._verify_dicom_filenames()
496+
if self.verify_dicom_filenames:
497+
self._verify_dicom_filenames()
496498
else:
497499
self._update_dicom_list()
498500

@@ -531,7 +533,6 @@ def _update_dicom_list(self, path: Optional[PathLike] = None):
531533
raise MissingDICOMFilesError(self.path)
532534

533535
if self.verify_dicom_filenames:
534-
# verify DICOM filenames have increasing numbers, with no gaps
535536
self._verify_dicom_filenames()
536537

537538
def _read_image_sitk(self, path: Optional[PathLike] = None) -> sitk.Image:

0 commit comments

Comments
 (0)