[FieldTrip] error when I convert .mri data into mgz or other format

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Apr 14 09:47:31 CEST 2015

Hi Zhang,

You should specify the anatomical data as a 3D array, not as a structure.

So rather than 
  ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)
you should do 
  ft_write_mri('ddd’,x.anatomy,'dataformat','mgz', 'transform',x.transform)

Note also that you should not expect an output from ft_write_mri.

best regards,

On 12 Apr 2015, at 17:32, thismoment <thismoment at 163.com> wrote:

> Hi Experts,
> I got a set of MEG. The anatomical MRI was stored in .mri format (CTF device) and MEG was stored in a folder named by xxx.ds.
> I do not know how to do segmentation of .mri into scalp,skull and cortex. So I try to convert .mri into .mgz or other format so
> that it can be used in freesurfer for reconstruction.
> I used the following command.
> x=ft_read_mri('MEG619.mri','dataformat','ctf_mri4');
> y=ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)
> the error was 
> >> y=ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)
> Error using fwrite
> Cannot write value: unsupported class struct
> Error in save_mgh (line 107)
> fwrite(fid,vol,'float32');
> Error in ft_write_mri (line 79)
>     save_mgh(dat, filename, transform);
> I failed to do it.
> 1. Anyone know what happens ?
> 2. Freesurfer can use .mri directly to reconstruct ?
> 3. Are there other methods to convert .mri into .mgz or .dicom format?
> Best wishes,
> J. Zhang
> 2015-04-12
> thismoment
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150414/dae2998e/attachment.html>

More information about the fieldtrip mailing list