Skip to content

Commit

Permalink
Merge pull request #3541 from moloney/bf-dcmstack
Browse files Browse the repository at this point in the history
BF: Update dcmstack interface for Py3 / newer pydicom
  • Loading branch information
effigies authored Mar 2, 2023
2 parents 28d424f + 071a40e commit cdfe679
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nipype/interfaces/dcmstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

have_dcmstack = True
try:
import dicom
import pydicom
import dcmstack
from dcmstack.dcmmeta import NiftiWrapper
except ImportError:
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cdfe679

Please sign in to comment.