-
Notifications
You must be signed in to change notification settings - Fork 27
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
NIFTI files flipped left-right / coordinate system #17
Comments
ok, some more digging, the matrices / images are apparently flipped in these two function calls in Volume.js:
Omitting them restores the correct imageOrientation matrix and ijk->patient space calculations are okay again BUT images are flipped bottom-up and left-right in cornerstone... |
even more digging, looks like all three functions call
are distorting the coordinate calculations when displaying it in cornerstone / doing ijk->patientspace calculations (I presume the when flipping the rotation matrix signs the origin coordinates need to be recalculated as well, especially in case of off-axis imaging), any thoughts on that? |
Hi @tpenzkofer! Did you manage to solve this? I am facing the same problem with the loader, Nifti files appear to be flipped. |
For anyone that runs into the same issue, it seems OHIF changed from Neurological to Radiological convention hence the image looks flipped on latest versions. The issue can be easily fixed by changing line 181 of the // if 'X-', we need to flip x axis so patient's right is
// shown on the right
if (senses[0] === '-') {
matrix[0][0] *= -1;
matrix[0][1] *= -1;
matrix[0][2] *= -1;
matrix[0][3] *= -1;
steps[0] = -1;
}
// if 'Y+' we need to flip y axis so patient's anterior is shown on the
// top
if (senses[1] === '+') {
matrix[1][0] *= -1;
matrix[1][1] *= -1;
matrix[1][2] *= -1;
matrix[1][3] *= -1;
steps[1] = -1;
}
// if 'Z+' we need to flip z axis so patient's head is shown on the top
if (senses[2] === '+') {
matrix[2][0] *= -1;
matrix[2][1] *= -1;
matrix[2][2] *= -1;
matrix[2][3] *= -1;
steps[2] = -1;
}
} you can change the convention to the Radiological view by switching the line to // if 'X+', we need to flip x axis so patient's right is
// shown on the left
if (senses[0] === '+') {
matrix[0][0] *= -1;
matrix[0][1] *= -1;
matrix[0][2] *= -1;
matrix[0][3] *= -1;
steps[0] = -1;
}
// if 'Y+' we need to flip y axis so patient's anterior is shown on the
// top
if (senses[1] === '+') {
matrix[1][0] *= -1;
matrix[1][1] *= -1;
matrix[1][2] *= -1;
matrix[1][3] *= -1;
steps[1] = -1;
}
// if 'Z+' we need to flip z axis so patient's head is shown on the top
if (senses[2] === '+') {
matrix[2][0] *= -1;
matrix[2][1] *= -1;
matrix[2][2] *= -1;
matrix[2][3] *= -1;
steps[2] = -1;
}
} Ideally the method should be renamed from |
Hi,
I have two - maybe related issues,
I have some Nifti files (derived from DICOM using dcm2niix) which are flipped left-right in cornerstone when loaded through cornerstone-nifti-image-loader, any ideas?
when calculating the patient space positions using "imagePointToPatientPoint" from cornerstoneTools using the imagePlane metaData information from cornerstone-nifti-loader the derived x/y coordinates are from the opposite corner of the image and the z coordinate is completely off (imagePointToPatientPoint does not take into account imageOrientationPatient, maybe that's the problem), as compared to Slicer RAS fiducial coordinates
Any ideas?
The text was updated successfully, but these errors were encountered: