From 071a40ebebfd46176ff2ede5c217e7e2131333f6 Mon Sep 17 00:00:00 2001 From: Brendan Moloney Date: Tue, 24 Jan 2023 13:20:35 -0800 Subject: [PATCH] BF: Update dcmstack interface for Py3 / newer pydicom --- nipype/interfaces/dcmstack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/dcmstack.py b/nipype/interfaces/dcmstack.py index 6909c0fc8f..49acf9f509 100644 --- a/nipype/interfaces/dcmstack.py +++ b/nipype/interfaces/dcmstack.py @@ -24,7 +24,7 @@ have_dcmstack = True try: - import dicom + import pydicom import dcmstack from dcmstack.dcmmeta import NiftiWrapper except ImportError: @@ -34,7 +34,7 @@ def sanitize_path_comp(path_comp): result = [] for char in path_comp: - if char not in string.letters + string.digits + "-_.": + if char not in string.ascii_letters + string.digits + "-_.": result.append("_") else: result.append(char) @@ -154,7 +154,7 @@ def _run_interface(self, runtime): stack = dcmstack.DicomStack(meta_filter=meta_filter) for src_path in src_paths: if not imghdr.what(src_path) == "gif": - src_dcm = dicom.read_file(src_path, force=self.inputs.force_read) + src_dcm = pydicom.dcmread(src_path, force=self.inputs.force_read) stack.add_dcm(src_dcm) nii = stack.to_nifti(embed_meta=True) nw = NiftiWrapper(nii)