Skip to content

Commit 39dfd5b

Browse files
committed
more fixes, works on example GE data, require dcm2niix patch
1 parent 5c692c0 commit 39dfd5b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

heudiconv/convert.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ def update_complex_name(metadata: dict[str, Any], filename: str) -> str:
332332

333333
# Check to see if it is magnitude or phase part:
334334
img_type = cast(List[str], metadata.get("ImageType", []))
335-
if "M" in img_type:
335+
if "M" in img_type or "MAGNITUDE" in img_type:
336336
part = "mag"
337-
elif "P" in img_type:
337+
elif "P" in img_type or "PHASE" in img_type:
338338
part = "phase"
339339
elif "REAL" in img_type:
340340
part = "real"
@@ -980,9 +980,16 @@ def save_converted_files(
980980
len(set(filter(bool, channel_names))) > 1
981981
) # Check for uncombined data
982982
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)
983+
is_complex = len(
984+
set(
985+
[
986+
part
987+
for its in image_types
988+
for part in CPLX_PARTS
989+
if part in its or part[0] in its
990+
]
991+
)
992+
) # Determine if data are complex (magnitude + phase or real + imag or all-4)
986993
echo_times_lst = sorted(echo_times) # also converts to list
987994
channel_names_lst = sorted(channel_names) # also converts to list
988995

heudiconv/dicoms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def create_seqinfo(
100100
# GE data
101101
# see https://github.com/rordenlab/dcm2niix/tree/master/GE#complex-image-component
102102
if dcminfo.get([0x43, 0x102F]):
103-
GE_CPLX_CODING = ["PHASE", "MAGNITUDE", "REAL", "IMAGINARY"]
103+
GE_CPLX_CODING = ["MAGNITUDE", "PHASE", "REAL", "IMAGINARY"]
104104
cplx_idx = int(dcminfo.get([0x43, 0x102F]).value)
105105
part = GE_CPLX_CODING[cplx_idx]
106106
if part not in image_type:

0 commit comments

Comments
 (0)