Skip to content

Commit 5c692c0

Browse files
committed
add complex part to ImageType for use in heuristics, it is done in dcm2niix when converting
1 parent ba524c1 commit 5c692c0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

heudiconv/convert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,10 @@ def save_converted_files(
979979
is_uncombined = (
980980
len(set(filter(bool, channel_names))) > 1
981981
) # Check for uncombined data
982-
PARTS = ["M", "P", "IMAGINARY", "REAL"]
983-
is_complex = (
984-
len(set(filter(lambda x: [part in x for part in PARTS], image_types))) > 1
985-
) # Determine if data are complex (magnitude + phase)
982+
CPLX_PARTS = ["MAGNITUDE", "PHASE", "IMAGINARY", "REAL"]
983+
is_complex = len(set([
984+
it for its in image_types for part in CPLX_PARTS if 'part'
985+
])) # Determine if data are complex (magnitude + phase or real + imag or all-4)
986986
echo_times_lst = sorted(echo_times) # also converts to list
987987
channel_names_lst = sorted(channel_names) # also converts to list
988988

heudiconv/dicoms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ def create_seqinfo(
9797
else:
9898
sequence_name = ""
9999

100+
# GE data
101+
# see https://github.com/rordenlab/dcm2niix/tree/master/GE#complex-image-component
102+
if dcminfo.get([0x43, 0x102F]):
103+
GE_CPLX_CODING = ["PHASE", "MAGNITUDE", "REAL", "IMAGINARY"]
104+
cplx_idx = int(dcminfo.get([0x43, 0x102F]).value)
105+
part = GE_CPLX_CODING[cplx_idx]
106+
if part not in image_type:
107+
image_type = image_type + (part,)
108+
100109
# initialized in `group_dicoms_to_seqinfos`
101110
global total_files
102111
total_files += len(series_files)

0 commit comments

Comments
 (0)