[FieldTrip] Axes mismatch switching from Fieldtrip to Freesurfer

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Mar 5 11:12:41 CET 2020


Dear Paolo,

Perhaps I don’t understand you, but the ‘fix’ would be to realign the image to ‘acpc’, or ‘ras’ in ft_volumerealign.

Just to reiterate what the whole rationale of the pipeline is:

Start from an anatomical image.
Use ft_volumerealign (twice) on this image to define 2 coordinate systems: 
1) for the MEG-system based coordinate system (’neuromag’ ‘ctf’ ‘itab’ ‘whatever-convention-is-used’), cfg.coordsys = ’neuromag/ctf/somethingelse’, and the clicking needs to be done on LPA,RPA,NAS
2) for an acpc-based RAS coordinate system, that is required by the anatomical processing freesurfer pipeline, cfg.coordsys = ‘acpc’ (or so), and clicking needs to be done on ac, pc, zpoint

Once you have 2 (non-resliced) MRI images that have 2 different transformation matrices, you at least can go from one coordinate system to the other by defining the transformation as mri1.transform/mri2.transform (or the other way around, depending on which direction you want to transform). 

Now, provided that Freesurfer manages to spit out its results in the acpc based coordinate system as defined in step 2) above, the preconditions are met to map the freesurfer results (provided they make sense) to the MEG based coordinate system.

The thing that next needs to be ensured, is that the input volume into the freesurfer pipeline makes sense in terms of the FOV and voxel orientation etc. This is achieved with mri_convert. The input into this command should be a ACPC-RAS registered volume, in combination with some magic input arguments (I believe -c and -oc ring a bell).

Note that ft_volumerealign does not do any reslicing, and that ft_determine_coordsys just visualises the 3 orthogonal slices, as per the information in the transformation matrix, and does not care about the definition of the coordinate system.

JM



> On 5 Mar 2020, at 10:48, Paolo Belardinelli <paolo.belardinelli at gmail.com> wrote:
> 
> Dear Jan-Mathijs,
> 
> in the meantime, I discovering the following:
> 1. The mismatch was due to the absence of my declaration of
> cfg.coordsys before ft_volumerealign. Despite the nifti file being in
> RAS, ft_volumerealign imposed an ALS coordinate system to the image.
> This was conflicting with some other information coming from the nifti
> file that freesurfer uses.
>     The previous call to ft_determine_coordinate_system did not
> assign the mri.coordsys field.
> 2. After correctly loading the image (Fig. Before) I am now declaring
> cfg.coordsys = 'neuromag' before calling ft_volumerealign. This makes
> the axes right but imposes a rotation of the head towards the inferior
> side of the figure of about 30° (Fig. After: I guess the horizontal
> plane is forced to be constituted by the plane which pass through LPA,
> RPA and Nasion).
> Is there a simple fix to this?
> 
> Best wishes,
> 
> Paolo
> 
> On Thu, Mar 5, 2020 at 8:15 AM Schoffelen, J.M. (Jan Mathijs)
> <jan.schoffelen at donders.ru.nl> wrote:
>> 
>> Hi Paolo,
>> 
>> I would check:
>> 
>> 1) whether the coordinate system in the aligned MR images is correct. Don’t use freeview, but do this with ft_determine_coordsys, and check whether the x/y/z axes are pointing into the expected direction
>> 2) what information freeview uses to ‘guess’ the a/p etc. directions. If this is anything else than the primary transformation matrix in the file (e.g. if it uses some magic variable such as slice order or so) then this might cause your reported discrepancy.
>> 3) (again) check whether the first step into the freesurfer pipeline script, i.e. the call to mri_convert is yielding the expected results. It is well known that freesurfer is very picky about the FOV and the orientation of the voxel space.
>> 
>> Best wishes,
>> Jan-Mathijs
>> 
>> 
>>> On 4 Mar 2020, at 15:06, Paolo Belardinelli <paolo.belardinelli at gmail.com> wrote:
>>> 
>>> Dear Fieldtrippers,
>>> 
>>> still about the source pipeline using both Fieldtrip and Freesurfer:
>>> - I load my nifti file with ft_readmri, without changing the axes
>>> - I reslice the voxels
>>> - I define the fiducials for sensor and acpc space definition.
>>> - I save in mgz format
>>> Then, if I visualize the mgz files with freeview the axes directions
>>> appear wrong  (L-R shown in the P-A window and so on)
>>> If I visualize the original .nii file, the projections appear correct.
>>> The mismatch appears nor to depend on the file format (I tried to
>>> save from FT in both mgz and nifti) neither on LPA and RPA
>>> definition (I tried to swap the 2 points).
>>> This has consequences on FS white matter segmentation: FS segments
>>> correctly the .nii file but it fails when using the mgz file I
>>> generated with FT.
>>> Did someone experience the same issue?
>>> 
>>> Best,
>>> 
>>> Paolo
>>> 
>>> 
>>> --
>>> --
>>> Paolo Belardinelli, PhD
>>> Neurology Department
>>> University Hospital Tuebingen
>>> Eberhard Karls University Tuebingen
>>> Hoppe-Seyler Str. 3
>>> D-72076 Tuebingen
>>> Tel: +49 7071 / 29 80478
>>> _______________________________________________
>>> fieldtrip mailing list
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> https://doi.org/10.1371/journal.pcbi.1002202
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://doi.org/10.1371/journal.pcbi.1002202
> 
> 
> 
> --
> --
> Paolo Belardinelli, PhD
> Neurology Department
> University Hospital Tuebingen
> Eberhard Karls University Tuebingen
> Hoppe-Seyler Str. 3
> D-72076 Tuebingen
> Tel: +49 7071 / 29 80478
> <After.jpg><Before.jpg>_______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202




More information about the fieldtrip mailing list