Skip to content
Snippets Groups Projects
Commit 69ad3ffb authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Fixes to dcmstack to make it work with python3 and pydicom:master

parent aa4a73bd
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,8 @@ into the package namespace. ...@@ -4,6 +4,8 @@ into the package namespace.
""" """
import warnings, re, dicom import warnings, re, dicom
from copy import deepcopy from copy import deepcopy
from collections import MutableSequence
import six
import nibabel as nb import nibabel as nb
from nibabel.nifti1 import Nifti1Extensions from nibabel.nifti1 import Nifti1Extensions
from nibabel.spatialimages import HeaderDataError from nibabel.spatialimages import HeaderDataError
...@@ -1091,18 +1093,21 @@ def parse_and_group(src_paths, group_by=default_group_keys, extractor=None, ...@@ -1091,18 +1093,21 @@ def parse_and_group(src_paths, group_by=default_group_keys, extractor=None,
# Unpack sub results, using the canonical value for the close keys # Unpack sub results, using the canonical value for the close keys
full_results = {} full_results = {}
for eq_key, sub_res_list in results.iteritems(): for eq_key, sub_res_list in results.items():
for close_key, sub_res in sub_res_list: for close_key, sub_res in sub_res_list:
full_key = [] full_key = []
eq_idx = 0 eq_idx = 0
close_idx = 0 close_idx = 0
for grp_key in group_by: for grp_key in group_by:
if grp_key in close_tests: if grp_key in close_tests:
full_key.append(close_key[close_idx]) val = close_key[close_idx]
close_idx += 1 close_idx += 1
else: else:
full_key.append(eq_key[eq_idx]) val = eq_key[eq_idx]
eq_idx += 1 eq_idx += 1
if isinstance(val, MutableSequence):
val = tuple(val)
full_key.append(val)
full_key = tuple(full_key) full_key = tuple(full_key)
full_results[full_key] = sub_res full_results[full_key] = sub_res
......
""" """
Extract meta data from a DICOM data set. Extract meta data from a DICOM data set.
""" """
import sys
import struct, warnings import struct, warnings
from collections import namedtuple, defaultdict from collections import namedtuple, defaultdict
import dicom import dicom
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment