Skip to content

Commit

Permalink
BF: Update dcmstack interface for Py3 / newer pydicom
Browse files Browse the repository at this point in the history
  • Loading branch information
moloney committed Jan 24, 2023
1 parent 7382b3d commit 071a40e
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 071a40e

Please sign in to comment.