-
Notifications
You must be signed in to change notification settings - Fork 12
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
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.
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 )
I really wish I could, I tried a lot and could not get the 2 to match ... |
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 |
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)