<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Zhang,<div><br></div><div>You should specify the anatomical data as a 3D array, not as a structure.</div><div><br></div><div>So rather than </div><div><span style="color: rgb(0, 0, 17); line-height: 1.3;"><font face="Courier">  ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)</font></span></div><div>you should do </div><div><span style="color: rgb(0, 0, 17); line-height: 1.3;"><font face="Courier">  ft_write_mri('ddd’,x.anatomy,'dataformat','mgz', 'transform',x.transform)</font></span></div><div><br></div><div>Note also that you should not expect an output from ft_write_mri.</div><div><br></div><div>best regards,</div><div>Robert</div><div><br></div><div><br></div><div><br><div><div>On 12 Apr 2015, at 17:32, thismoment <<a href="mailto:thismoment@163.com">thismoment@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div marginheight="0" marginwidth="0" style="font-size: 12.1pt; color: rgb(0, 0, 17); font-family: 宋体, serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; line-height: 1.3; border-width: 0px; margin: 12px;"><stationery><div><font size="4" face="宋体">Hi Experts,</font></div><div> </div><div>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.</div><div>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</div><div>that it can be used in freesurfer for reconstruction.</div><div>I used the following command.</div><div> </div><div>x=ft_read_mri('MEG619.mri','dataformat','ctf_mri4');<br>y=ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)</div><div> </div><div>the error was </div><div> </div><div>>> y=ft_write_mri('ddd',x,'dataformat','mgz', 'transform',x.transform)<br>Error using fwrite<br>Cannot write value: unsupported class struct</div><div> </div><div>Error in save_mgh (line 107)<br>fwrite(fid,vol,'float32');</div><div> </div><div>Error in ft_write_mri (line 79)<br>    save_mgh(dat, filename, transform);</div><div> </div><div>I failed to do it.</div><div>1. Anyone know what happens ?</div><div>2. Freesurfer can use .mri directly to reconstruct ?</div><div>3. Are there other methods to convert .mri into .mgz or .dicom format?</div><div> </div><div>Best wishes,</div><div>J. Zhang</div><div> </div><div> </div><div align="left"><font color="#c0c0c0" size="2" face="Verdana">2015-04-12</font></div><font size="2" face="Verdana"><hr id="SignNameHR" align="left" size="2" style="width: 122px; height: 2px;"></font><div><font color="#c0c0c0" size="2" face="Verdana"><span id="_FlashSignName">thismoment</span></font></div></stationery>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></blockquote></div><br></div></body></html>