diff --git a/heudiconv/convert.py b/heudiconv/convert.py index 69aada89..9bc6e0b7 100644 --- a/heudiconv/convert.py +++ b/heudiconv/convert.py @@ -979,10 +979,10 @@ def save_converted_files( is_uncombined = ( len(set(filter(bool, channel_names))) > 1 ) # Check for uncombined data - PARTS = ["M", "P", "IMAGINARY", "REAL"] - is_complex = ( - len(set(filter(lambda x: [part in x for part in PARTS], image_types))) > 1 - ) # Determine if data are complex (magnitude + phase) + CPLX_PARTS = ["MAGNITUDE", "PHASE", "IMAGINARY", "REAL"] + is_complex = len(set([ + it for its in image_types for part in CPLX_PARTS if 'part' + ])) # Determine if data are complex (magnitude + phase or real + imag or all-4) echo_times_lst = sorted(echo_times) # also converts to list channel_names_lst = sorted(channel_names) # also converts to list diff --git a/heudiconv/dicoms.py b/heudiconv/dicoms.py index 2c3d8029..627fd92f 100644 --- a/heudiconv/dicoms.py +++ b/heudiconv/dicoms.py @@ -97,6 +97,15 @@ def create_seqinfo( else: sequence_name = "" + # GE data + # see https://github.com/rordenlab/dcm2niix/tree/master/GE#complex-image-component + if dcminfo.get([0x43, 0x102F]): + GE_CPLX_CODING = ["PHASE", "MAGNITUDE", "REAL", "IMAGINARY"] + cplx_idx = int(dcminfo.get([0x43, 0x102F]).value) + part = GE_CPLX_CODING[cplx_idx] + if part not in image_type: + image_type = image_type + (part,) + # initialized in `group_dicoms_to_seqinfos` global total_files total_files += len(series_files)