BrkRaw / brkraw

BrkRaw: A comprehensive tool to access raw Bruker Biospin MRI data
https://brkraw.github.io
GNU General Public License v3.0
44 stars 27 forks source link

rostral-caudal axis is flipped for tail prone data #9

Closed eugenegkim closed 4 years ago

eugenegkim commented 4 years ago

Very nice tool! My only issue is that the rostral-caudal (anterior-posterior) axis is the wrong way around for my tail prone dataset even though the Entry field is correctly identified as "FeetFirst". Is there a way to flip the orientation in this case?

dvm-shlee commented 4 years ago

@eugenegkim That's just a bug because I haven't had enough test case for that. Could you provide the dataset that causes the issue? then I can fix it for the next update.

Thank you!

dvm-shlee commented 4 years ago

@eugenegkim Oh BTW, could you let me know if it just flipped or rotated 180 degrees so that the left and right are also flipped?

If you are urgent to access the data and If you are familiar with python, you can easily correct that with python API.

For example. as below.

import numpy as np
import nibabel as nib
import brkraw as br
from brkraw.lib.utils import apply_rotate
raw = br.load('<your raw data path>')
old_nii = raw.get_niftiobj(<scan_id>, <reco_id>)
new_affine = apply_rotate(old_nii.affine, rad_y=np.pi)

new_nii = nib.Nifti1Image(old_nii._dataobj, affine=new_affine, header=old_nii._header)
new_nii.to_filename('<new filename>')
eugenegkim commented 4 years ago

Oh good point. It looks like it's rotated 180 degrees. I use an in-house converter, so it's not urgent. But I'm looking into making all my data BIDS-compliant. I'll send you the dataset in a moment. Thanks!

dvm-shlee commented 4 years ago

@eugenegkim Oh BTW, have we meet at the Bruker sequence programming course? Your name is familiar 😃

eugenegkim commented 4 years ago

Yeah! Seems like ages ago. Hope you and all your loved ones are doing well.

dvm-shlee commented 4 years ago

@eugenegkim Thanks for sharing the data. I will update the code once I clarify the issue. Regarding the BIDS, there is something I haven't documented yet (for JSON), so if you experiencing any issue, please let me know.

dvm-shlee commented 4 years ago

@eugenegkim I found using your dataset that Bruker does internal correction for the position, so actually no need additional correction, but my code originally did. It has been removed now. It will work without issue from v0.3.3 released version.

eugenegkim commented 4 years ago

Thanks!