Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jpcoutu opened this issue Jan 17, 2018 · 2 comments
Open

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

jpcoutu opened this issue Jan 17, 2018 · 2 comments

Comments

@jpcoutu
Copy link

jpcoutu commented Jan 17, 2018

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");
          }
        }
@vfonov
Copy link
Member

vfonov commented Jan 17, 2018

@rdvincent ?

@jpcoutu
Copy link
Author

jpcoutu commented Jun 14, 2021

This is fixed in #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants