-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
BUG: Fix incorrect reading of MINC2 files, convert RAS coordinates to LPS #4864
BUG: Fix incorrect reading of MINC2 files, convert RAS coordinates to LPS #4864
Conversation
TODO:
|
0b2f6bc
to
23f65ad
Compare
I'd be interested to try this in our app when you think it's in shape... |
I'll try to make changes.... |
https://github.com/vfonov/ITK/commits/MINC_IMAGE_RAS_LPS_VF/ - here is my work in progress, i am going to add tests for all the new cases... |
Would any of the enums enums for the AnatomicalOrientaion PR be useful here? I am seeing a lot of LPS and RAS terms in this PR which can be little ambiguous. At lease the public interface of "RAS_to_LPS" the setter getter could be clarified and be make unambiguous. |
What would make it less ambiguous? |
OK, How do i push my changes here from https://github.com/vfonov/ITK/tree/MINC_IMAGE_RAS_LPS ? |
Pushing to Gabriel's branch should work:
The above assumes that the you have created your
should have the desired effect. If you run into trouble, you can start a fresh branch (assuming you rename your local
|
|
@gdevenyi should be able to grant permissions to push to his ITK fork on GitHub, which should fix the issue. |
I have invited @vfonov |
So |
This newly merged class should provide some documentation to better describe the coordinate changes in an unambiguous fashion: https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkAnatomicalOrientation.h |
so, where does this new class apply in the proposed change? |
Please document what you mean by RAS in the unambiguous terminology described in that class. |
So, it's a documentation question - i.e I should updated documentation of the MINC reader Module? |
@gdevenyi - can you make changes requested by @blowekamp ? I do not understand what's required here. |
8529adf
to
c170e0f
Compare
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.
Thanks for doing this @gdevenyi. An in-line style comment.
c170e0f
to
5a46692
Compare
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.
Left some style-related comments. There is a conflict that needs to be resolved since the code base has undergone some extensive style-related changes in the meantime.
While at it, stick to the commit message conventions: use sentence case (capitalize first letter), finish commit message BODY explanation with a period.
@vfonov @gdevenyi It is my understanding that this PR has conflicts due to all the recent activity. Thank you for the contribution and maintaining MINC for ITK. Can I help updating the PR, and trying to address some of these style issues? Also, I think we should do this change in 2 steps. This first is adding the LPS as an option preserving compatibility. And is a second PR, change the default? Maybe introduce an environment variable for this setting too? Let me know if I can help make changes to get this PR through. |
Yes please. I would very much appreciate the help. This contribution to ITK has been 6 years in the making with the original technical solution remaining unchanged. I'm a generalist and ITK is a C++-expert level codebase, I'm a monkey at a typewriter here trying to keep up with the high churn and level of abstraction that this codebase demands. The complexity along with the serial reviews have made it very difficult. I would very much appreciate any help you can offer. |
So, I don't understand - what needs to be done right now. Do we neeed:
|
Yes, I thin that is a summary of what needs to be done. I am also going to separate the change in behavior for another PR, to make review easier. I am going to start working on update the PR branch. |
Glad to see this work. Again, when it's in better shape, I'll give it a try in our app, which has various tests of its own that might exercise some of this. |
a8811a0
to
d051e5f
Compare
I have updated the PR. For now I removed the CMake option, and have kept the behavior the same as it was. This can be changed in another PR. Is it useful to still write with the the corrected coordinates? I am thinking that the correct cordinates should always be written no, and the flag is used then loading. The "RAStoLPS" flag was not immediately clear to be what it did. Perhaps something line "ApplyCoordiateConversionForITK" would be more descriptive? Also is there meta-data written in the transform to indicate that coordinates have been corrected? |
The correct coordinates for a MINC file are RAS on-disk. This dynamic conversion must happen during both read and write into ITK.
Yes, this rename is reasonable.
Similar to the image format, there is only one right way for the coordinate to be represented in MINC-land so there's no need to note correction Ref: https://en.wikibooks.org/wiki/MINC/SoftwareDevelopment/MINC2.0_File_Format_Reference |
We will test this at the hackathon tomorrow. If you have time to rebase it against master that'd be great. |
d051e5f
to
f85e404
Compare
Done. |
I can say that building our own app against this PR works, all our tests still pass too. That's a low bar mind you, we don't ourselves have extensive MINC testing (we mostly rely on upstream). Are there sample files should should behave differently before and after this change? |
The PR includes the changes to the tests which show how things change. Fundamentally, this fix allows MINC and non-minc files to be mixed together inside a ITK pipeline since they will now correctly have the same internal coordinate system representation. Before this PR, the MINC files would be flipped around such that they were self-consistently wrong in terms of input/output, but couldn't cross the boundary to another file format correctly. |
Gabriel, Vladimir, and Brad, this PR seems close. What is left to do besides removing |
@dzenanz if the developers who were asking for style changes are happy with the commits now I believe this is ready. |
f85e404
to
d74329e
Compare
convert MINC PositiveCoordinateOrientation RAS coordinates to ITK PositiveCoordinateOrientation LPS coordinates during reading and writing
convert MINC PositiveCoordinateOrientation RAS coordinate system to ITK PositiveCoordinateOrientation LPS
Remove MINC IO RAS to LPS CMake flag. Commits f97618b and 9eb1b70 address the contrasting internal image orientation conventions used by ITK and MINC, making MINC follow the same convetion as ITK. Thus, the corresponding conversion CMake flag is no longer necessary. Set the ivar `m_RAStoLPS` default value to `false` following the change.
Adopt ITK style conventions in MINC module code: adopt the recommended variable naming conventions.
d74329e
to
7cfde0f
Compare
I have removed the Edit: I now see that the commit (6e75f1f) at issue removes lines of code that were introduced in another commit (50f6526) in this PR. Those changes should be merged and the unnecessary commit be removed, but given the state of things, I would prefer to avoid further difficulties with this PR. So this is ready to go for me. |
Remove empty end of file line in excess. Fixes: ``` diff --git a/Documentation/docs/releases/5.4.2.md b/Documentation/docs/releases/5.4.2.md index 64cb36c..78f5864 100644 --- a/Documentation/docs/releases/5.4.2.md +++ b/Documentation/docs/releases/5.4.2.md @@ -272,4 +272,3 @@ Remote Module Changes Since v5.4.0 #### Bug Fixes - Bump Python package version for re-deploy ([9f6654d](InsightSoftwareConsortium/ITKTotalVariation@9f6654d)) - ``` raised for example in: https://github.com/InsightSoftwareConsortium/ITK/actions/runs/13343048744/job/37270119146?pr=4864#step:5:133
Thank you all! |
Thank you all 🎉🎉🎉 |
Replaces #147
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.