Skip to content

Commit d2599e6

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

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
@@ -106,6 +106,15 @@ def create_seqinfo(
106106
else:
107107
sequence_name = ""
108108

109+
# GE data
110+
# see https://github.com/rordenlab/dcm2niix/tree/master/GE#complex-image-component
111+
if dcminfo.get([0x43, 0x102F]):
112+
GE_CPLX_CODING = ["PHASE", "MAGNITUDE", "REAL", "IMAGINARY"]
113+
cplx_idx = int(dcminfo.get([0x43, 0x102F]).value)
114+
part = GE_CPLX_CODING[cplx_idx]
115+
if part not in image_type:
116+
image_type = image_type + (part,)
117+
109118
# initialized in `group_dicoms_to_seqinfos`
110119
global total_files
111120
total_files += len(series_files)

0 commit comments

Comments
 (0)