Skip to content

BF: Update dcmstack interface for Py3 / newer pydicom #3541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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