Skip to content

Siemens mosaic diffusion scan upside down (and solution) #75

Description

@jpcoutu

We have a dicom series for which the scan was flipped upside down. The mosaic has a clear transverse orientation (as observed with xmedcon), but this bit of code went wrong (in parse_siemens_proto2 in dicom_to_minc.c) and determined the mosaic has coronal orientation, because the direction cosine along z was -0.99, and absolute values are not used when doing comparisons:

        else if (!strcmp(name, "SliceNormalVector")) {
            if (vm == 3 && n_values >= vm) {
                Acr_Double tmp[3];
                Acr_Short orientation;

                tmp[0] = atof(value[0]);
                tmp[1] = atof(value[1]);
                tmp[2] = atof(value[2]);
                
                orientation = TRANSVERSE;
                if (tmp[0] > tmp[2] && tmp[0] > tmp[1]) {
                  orientation = SAGITTAL;
                }
                else if (tmp[1] > tmp[2] && tmp[1] > tmp[0]) {
                  orientation = CORONAL;
                }
                acr_insert_numeric(&group_list, EXT_Slice_orientation,
                                   orientation);
            }
        }

The solution was simply to change to tmp[i] = fabs(atof(value[i])) for the values in the tmp array.
The downstream effect with the orientation being set wrong is that EXT_Slice_inverted does not get set to 1 in add_siemens_info as it should when sSliceArray.ucImageNumbTra is 1, resulting in the flip:

        temp = acr_find_int(group_list, EXT_Slice_orientation, -1);
        prot_find_string(protocol, "sSliceArray.ucImageNumbTra", str_buf);
        if (str_buf[0] != '\0') {
          if (temp == TRANSVERSE && strtol(str_buf, NULL, 0) == 1) {
            acr_insert_string(&group_list, EXT_Slice_inverted, "1");
          }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions