Skip to content
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

Finally get right Orientation from raw data #230

Merged
merged 24 commits into from
Jan 13, 2025

Conversation

chaithyagr
Copy link
Member

This is continuation of saga in #157 which was based on twixtools, which was not working well to read data.
Finally we have this working.

Some notes for how I got this working:

The base notes of how quaternion is ordered in data: https://github.com/ismrmrd/siemens_to_ismrmrd/blob/993ff5ffa74b4f719af36264e98698b05683498b/main.cpp#L1131-L1142

Which calls :
https://github.com/ismrmrd/ismrmrd/blob/802b52d69dcc31935888d3c69cc2a179f13a5608/libsrc/ismrmrd.c#L668-L683

However notice that call is Phase Read Slice, while the function expects Read Phase Slice. This mis-match is as data is expected to be Y X Z co-ordinates, cause I dont know why (@paquiteau has some links xD)

Based on this I almost got it working except sometimes the brain was inverted, and I found: https://github.com/ismrmrd/ismrmrd/blob/802b52d69dcc31935888d3c69cc2a179f13a5608/libsrc/ismrmrd.c#L578-L610

Where you try to change orientation based on if determinant of rotation matrix is negative (to keep it 1)

@chaithyagr chaithyagr self-assigned this Jan 9, 2025
@chaithyagr chaithyagr requested a review from paquiteau January 9, 2025 16:03
Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job !

How do you want to use the orientation attribute later on ?

also, it may be nice to use:

https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html

for the computation (that way I won't ask for a unit test :P )

src/mrinufft/io/utils.py Outdated Show resolved Hide resolved
@chaithyagr
Copy link
Member Author

also, it may be nice to use:

https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html

for the computation (that way I won't ask for a unit test :P )

I really wish I could, I tried a lot and could not get the 2 to match ...

@chaithyagr
Copy link
Member Author

I think its because of all the intricacies like having it as Y X Z coordinates etc. Lemme see if I can fix it though

@chaithyagr chaithyagr requested a review from paquiteau January 13, 2025 08:47
@paquiteau paquiteau merged commit 0cdfef4 into mind-inria:master Jan 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants