-
Notifications
You must be signed in to change notification settings - Fork 191
fix transformcalc header #2102
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
base: master
Are you sure you want to change the base?
fix transformcalc header #2102
Conversation
|
Yes, I can see this is going to be an issue. I'm not sure what the best way to fix this is going to - I imagine setting |
|
|
Suggested alteration: In #2526 I propose that the |
|
Pinging @ppruc. This needs to be revisited following #3011. What I expect is necessary is that any calculations that involve header transforms of input images need to be made with respect to the transform of the image as it is stored on disk, not as it is interpreted by MRtrix, which has possibly experienced a realignment through shuffling of transform axes & strides. With the changes in #3011 there is explicit tracking of the transform of the image on disk, as well as what such shuffling was applied at the point of image load; the former should I think be what any header-transform-dependent calculations are based on. It's possible that the scope of erroneous transform calculations extends beyond just |
|
f80219e to
91ac6ac
Compare
| transform_type forward_transform = Transform(modified_header).voxel2scanner * Transform(orig_header).voxel2scanner.inverse(); | ||
| save_transform (forward_transform.inverse(), output_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this composed the transform from modified header to original header and then inverted it, as opposed to just computing the transform from original heder to modified header...
|
I initially commenced re-writing this operation to always make use of the transform as stored on disk. However I think there is scope for this to also be erroneous: the transform being sought could conceivably be the difference between two voxel grids after MRtrix3's closest-to-RAS re-interpretation. So what I have opted for instead is to produce a warning in any circumstance where the value of |
|
Back to draft: requires more comprehensive tests.
, the output transform should be the identity matrix, but that's not what comes out... Edit: Presumably this is because I'm applying a transform relative to scannerspace axes. So what I need is to define the appropriate scannerspace transform such that, following the MRtrix3 internal transform realignment, there is no difference in the transforms of the two interpreted headers. |
|
Still having trouble devising one of the tests that I actually want to apply to ensure correct operation (as opposed to adding a test that checks for regression against the wrong answer). I want to apply a linear transform to an image whose header transform is not the identity matrix (eg. |
- Test issuing of warnings and evaluation of appleid transform for pure transverse input image. Attempted tests involving non-pure-transverse image intentionally commented out; derivation of the appropriate transform that results in equivalence of two images following internal image realignment is a topic of future work.
As reported on the forum,
transformcalc headerfails for large rotations inmrview's transformation tool due to the axis interpretation.The proposed solution is to set
Header::do_realign_transform = false;. I think this is sensible given the purpose of the tool but I am not sure if this brings any negative side effects for other use cases. Any opinions?