[FieldTrip] Problem with ft_volumewrite and axis labels

Johan Wessberg johan.wessberg at gu.se
Thu Feb 16 16:27:47 CET 2017

Thanks! I erroneously assumed that the axes coordinate system was exported along with the volume data.

Johan Wessberg

From: <fieldtrip-bounces at science.ru.nl> on behalf of "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl>
Reply-To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Thursday, 16 February 2017 at 15:09
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Problem with ft_volumewrite and axis labels

Hi Johan,

ft_volumewrite does not write any information with respect to how the axes in the coordinate system need to be interpreted to the output file. In other words, it only writes the anatomical image, along with some transformation matrix that typically maps voxels to head coordinates. If the external software ‘expects’ some specific coordinate system, or if it defaults to interpreting the coordinate system along to some convention, if it cannot find the required information in the file, the mapping may or may not be correct.

In your case it seems that freeview interprets the x/y/z axes in the coordinate system (attached with the MRI-file) as RAS, whereas you expected it to be correctly interpreted as ALS (CTF-convention). You could write the volume with a RAS transformation matrix.



J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

On 16 Feb 2017, at 13:25, Johan Wessberg <johan.wessberg at gu.se<mailto:johan.wessberg at gu.se>> wrote:


I have checked the archives without finding an answer or seeing a discussion of this problem.

We are trying to use ft_volumewrite() to export functional and anatomical data for visualization outside FieldTrip, for example with Freeview. The problem is that the orientation of the axes is wrong, AP and RL have been swapped. But when checking the axes with ft_determine_coordsys() they are fine.

Using either MGZ or NIFTI file formats does not matter. I get the same problem when opening the files in either Freeview or MRIcron.
ft_volumewrite() has a cfg.coordsys option that includes a ‘ctf’, but it does not help (and the documentation says that this will only matter for Analyze, vmp, and vmr file formats anyway).

Here is a screen copy from FreeView:


And here is the figure from ft_determine_coordys()  (the yellow labels are hard to read, but they are correct)


The functional data have been acquired with the CTF MEG in Nottingham, and the MRI data have been co-registered in CTF coordinates for functional analysis. All source analyses and plots are fine inside FT, my problem is only to export the data correctly using ft_volumewrite().

Has anyone had the same problem?

Johan Wessberg

Inst. of Neuroscience and Physiology
University of Gothenburg, Sweden

fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170216/49550a45/attachment-0002.html>

More information about the fieldtrip mailing list