volumewrite

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Thu Sep 13 22:27:03 CEST 2007


Dear Marie,

Handling of volume-data is a tricky business, and in particular when
different coordinate systems are used. As far as I can see, I'd advice you
to use the following configuration, although I am not used to using the
volumewrite function (because who would want to visualize the data otherwise
than using sourceplot?).
cfg.coordinates = 'ctf' (true?): this means that the x-axis runs from
back-to-front, the y-axis from right-to-left, and the z-axis from
bottom-to-top.
On the other hand, an 'spm' coordinate system has it x-axis running from
left to right, and the y-axis from back-to-front. This means that at least
the first two dimensions of the data-matrix should be swapped, in
combination with a subsequent affine-transformation (I suspect some info
about transformation-matrices in on the fieldtrip website).
This is done when you specify cfg.filetype = 'analyze' instead of 'spm'
(relevant code is on the lines beyond line 282 in volumewrite.m. Why this
swapping is not applied when specifying cfg.filetype='spm' is a mystery to
m, but I guess there's a good reason for it.
Summarizing: cfg.coordinates = 'ctf', and cfg.filetype = 'analyze' might
help. On the other hand you could stick to sourceplot, which I guess is
lacking some functionality, and which is the reason for you to convert it
back to analyze (does it by any chance has to do with matching voxels with
brain regions ;-)?). Let's implement this soon then.

Yours,

Jan-Mathijs

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Marie Smith
Sent: Thursday, September 13, 2007 7:23 PM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: [FIELDTRIP] volumewrite

Hi,

I am trying to output the results of sourceinterpolate to analyze
format to read in afni / spm2. The volumewrite function does seem to
do this but the orientation of the output mri is not correct when
viewed in spm2 / afni (coronal is axial and rotated 90degrees,
sagittal is coronal also rotated and axial is sagittal also rotated).
I have checked and it seems to display correctly in sourceplot (in
that it matches the images shown in the tutorial documentation for
beamforming).

I am selecting cfg.coordinates = 'cfg' and cfg.filetype = spm in
volumewrite and leaving the rest to the defaults.
Could there be an orientation error coming in from somewhere and how
can I fix it ?

Also on a related point, i also tried cfg.filetype = 'analyze' and
got quite a different output when viewed in spm. The slices seemed to
have been rotated in some way in addition to errors in the orientation.

Any advice would be appreciated,

Marie

----------------------------------
The aim of this list is to facilitate the discussion between users of the
FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
and EEG analysis. See also
http://listserv.surfnet.nl/archives/fieldtrip.html and
http://www.ru.nl/fcdonders/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list