-
Notifications
You must be signed in to change notification settings - Fork 23
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
Transform mask data if orientation does not match volume, fixes #346 #349
Conversation
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.
Thank you for your PR! Please ensure you've read DiffDRR's development guide.
Hi @LukasNickel thanks a bunch for the PR. Looks good to me! To properly merge it, the changes have to be written into notebook (see the dev guide). If that's cumbersome, I can push those changes to this branch sometime soon. |
I will have a look, just ran out of time on friday. Although I have to admit, I initially misunderstood the purpose of the notebooks. Edit: OH, I had it backwards! You develop in the notebook and export that. That is both pretty neat (although I am undecided on whether its a net positive) and not really clear from the README imo. |
Turns out I completely skipped over the autogenerated comment in the code. There might still be a benefit of making the text in the README clearer, but I would say its 90% on me here and the description is mostly fine. |
- Nibabel returns a numpy array, torch expects tensors
Hi @LukasNickel thanks for the PR and the feedback. Looks good to me! I updated the README to be clearer. |
Closes #346 |
Minimal addition to the code to fix the issue, that the volume and mask data have different orientations.
I avoided
ToCanonical
and instead only transform the mask data to match the volume.After trying to implement the transform myself, I decided the safest way is probably to use the
nibabel
functionality directly.Torchio
unfortunately only includes the transformation to canonical coordinates as far as I can tell...Should be working fine, but I did not really test it much yet, which is why this is marked as draft. Hopefully I have the time for that on monday.