-
|
Dear BrainVISA experts, Thank you for helping me identify an issue with the transformations I am using to import FreeSurfer files into the Morphologist 2021 pipeline. I am following up in this new thread to ask about how these transformations are calculated when importing. My issue is that after loading talairach referential in several subjects' sulcal graph in anatomist, the sulcal graphs do not align, mostly misaligned in the y and z planes. Upon checking the AC-PC coordinates for each subject using the Morphologist > viewers > view commissure coordinates process, I saw that the AC/PC coordinates were never on the true AC/PC coordinates in the y and z directions (but were correct / in the center of the brain for the x coordinate). I first checked to see if my talairach transformations (input to the Import FreeSurfer to Morpho process) (as talairach.auto.xfm) were okay. Checking through my subjects, each transformation yielded proper alignment in freesurfer talairach templates. I noticed in the source code for the process, the transformations seem to be in this form (when reading the Import_FROM_FreeSurfer_TO_Morpho.py and TalairachTransformationFromNormalization.py called within the former): also allowing operations like: Since my transformations in A were checked out, and C seems to be built in to BrainVISA, I am curious about B. How are the transformations in the header of the temporary nifti file for orig.mgz calculated? I am using brainvisa without the FreeSurfer home path specified -- will a different conversion take place if I allow BrainVISA to use FreeSurfer directly? Is this a reasonable place to look towards resolving my transformation issue? Also, I apologize for the long message but wanted to be as verbose as possible in case I might miss any potential hints towards figuring this out. Thank you for the help!! Best, |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 3 replies
-
|
Hi, |
Beta Was this translation helpful? Give feedback.
-
|
So you are right: when the .mgz is converted using the Aims converter, the transform to the scanner-based referential is wrong: it is just a "default" transformation going to the center of the image. As I said in the previous message, we don't have a reader which reads directly Freesurfer formats, we do it through the Minc lib which now supports it (thus it comes for free in the Minc reader) and I don't know if there is a means to get the right transform through the minc lib, or if it doesn't read it at all. I have to investigate. If it doesn't do it then we have to take care when using this reader/converter, and maybe explicitly disable it from the freesurfer / morphologist import process. |
Beta Was this translation helpful? Give feedback.
-
|
Well, the libminc doesn't read this info from .mgz files. We have noticed it and the Aims reader prints a warning "Warning: transformations in a freesurfer .mgh / .mgz are probably wrong.", but I had forgotten about it. I have started digging into the code, and it seems that libminc has an internal function with a bool parameter to tell it if it should ignore offsets in the header, and this function is called with this flag set to ignore (hard-coded) from the read code. I'm trying to copy the function and call it manually and see if I can make something out of it... |
Beta Was this translation helpful? Give feedback.
-
|
Hm, when several converters can do the same job, I'm not sure the converters are ordered/prioritized in brainvisa, thus |
Beta Was this translation helpful? Give feedback.
-
|
I have opened a ticket brainvisa/soma-io#17 |
Beta Was this translation helpful? Give feedback.
-
|
I'm testing a bit before I propose any patch, but I will (if it works as expected)... |
Beta Was this translation helpful? Give feedback.
-
|
I have finally succeeded in reading the transformation in mgh/mgz files, but it's in compiled code that is not so easy to update in a binary distribution. In the meantime I have patched the Aims converter process to exclude freesurfer formats until the next version of Aims. This way it will not be taken as a converter, and will leave this task to the freesurfer converter (based on mri_convert). |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for all the help here! I have one last question -- I was able to get these scripts running well on my virtual machine copy of brainvisa but am still figuring it out for singularity. I performed the steps you mentioned, and now my brainvisa install directory has all the extra subdirectories such as /casa/install . However, now I am unable to run any brainvisa commands -- any time I type "brainvisa" or "bv" into the terminal, I get I tried changing the PYTHONHOME variable to {path of my brainvisa install}/install/python, and the first three lines of that error disappeared, but I still receive the How may I configure my new brainvisa-singularity install to fix this? Thanks again! |
Beta Was this translation helpful? Give feedback.
-
|
The read/write install from singularity should install things in |
Beta Was this translation helpful? Give feedback.
-
|
Oh yes, you should not set |
Beta Was this translation helpful? Give feedback.
Well, the libminc doesn't read this info from .mgz files. We have noticed it and the Aims reader prints a warning "Warning: transformations in a freesurfer .mgh / .mgz are probably wrong.", but I had forgotten about it. I have started digging into the code, and it seems that libminc has an internal function with a bool parameter to tell it if it should ignore offsets in the header, and this function is called with this flag set to ignore (hard-coded) from the read code. I'm trying to copy the function and call it manually and see if I can make something out of it...