-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
NRRDLoader handling of coronal and sagittal oriented scans. #21962
NRRDLoader handling of coronal and sagittal oriented scans. #21962
Conversation
…ections" field within an NRRD file to orient and transform the volume structures properly in 3D space, fixing the previously broken sagittal and coronal oriented scans.
…d only how the spacing (and thus, the size) is calculated by changing its read target. This is done by storing axis order as a new member of the Volume objects
The newest commit improves upon the first iteration of the solution by allowing for future extensions to support different coordinate systems. For now, the solution fixes the NRRDLoader's initial ability to load both Before the suggested additions to the code, a sagittal scan would look similar to this: After the fix, they now scale properly. For the above examples, an NRRD from the following DICOM directory is used. Some additional notes gathered from implementing this fix, for future thought:
This PR is intended to resolve the immediate issue of improper scaling of slices. Additional improvements or additions will be in a separate PR. |
Thanks! |
@developers-mirrorme3d Made some clean up. Hopefully I didn't break anything. 2f6358d |
Related issue: Fixed #21898
Description
The IJK -> RAS transformation matrix is being loaded with hard-coded assumptions. The scans are presumed to fall under an (X, Y, Z) order. The transformation matrix is assumed to be the following.
This is true for any NRRD with an axial scan order, however, as a result of this assumption any coronal or sagittal oriented scan will be incorrectly transformed and look incredibly stretched on one axis and squished on another. The transformation matrix could be in the forms of:
To illustrate this point, the header of an axial oriented NRRD is as follows, you will notice that the
space directions
field is in the form of the identity matrix and thus will be processed correctly by the NRRDLoader as it is now.An NRRD with a coronal scan order can have a header with
space directions
in a different orientation, which is where the NRRDLoader will struggle to transform properly:The transformation matrix can also hold negative values which indicate a flip, previously ignored and instead operated on by the
space
field within an NRRD. The proposed changes within this PR take this into account by thespace directions
matrix instead.To summarize the proposed solution included in this PR:
space directions
matrixspace directions
matrix as the source of truth for axis flipping instead of thespace
header entry