<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span></span><div></div><div><br><div><div>On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Jan,<br><br>I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). <br><br>This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now?<br> <br>Thanks again for your help,<br><br>Jen<br><br><div class="gmail_quote">On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman <span dir="ltr"><<a href="mailto:jenwhitman@gmail.com">jenwhitman@gmail.com</a>></span> wrote:<br> <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Great, thanks!<br><br>I'll start the analysis with your new script today and will let you know how it works out.<br> <font color="#888888"><br>Jen<br><br></font><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br> </div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5"><div style="word-wrap: break-word;">Dear Jen,<div> <br></div><div>I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8.</div> <div><br></div><div>Best wishes,</div><div><br></div><font color="#888888"><div>Jan-Mathijs</div><div><br></div><div><br></div><div></div></font></div><br></div></div><div style="word-wrap: break-word;"><div></div><div><br> </div><div> <br><div><div class="im"><div>On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote:</div><br></div><div><div></div><div class="h5"><blockquote type="cite"><br>Dear Jan,<br><br>Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated.<br> <br>Jen<br><br><br>%%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense).<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br> <br> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow;<br><br> cfg = [];<br> cfg.downsample = 2;<br> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri);<br><br> % projecting the plot onto a surface...<br> cfg = [];<br> cfg.coordinates = 'ctf';<br> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates<br> sourcetempIntN = volumenormalise(cfg, sourcetempInt);<br> <br> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms'];<br> cfg=[];<br> cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai'<br> cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension<br> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr'<br> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = [])<br> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double'<br> <br> volumewrite(cfg, sourcetempIntN)<br><br> <br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%% this code below hasn't worked yet...<br> <br>% I added cfg.spmversion = 'spm8';<br>% in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis,<br>% and in the call to prepare_singleshell after calling volumesegment<br><br>% I've also ensured that spm8 is the only spm version in my path, even in<br> % the fieldtrip/external folder, and ensured that spm8 is installed properly<br>% (files compiled correctly, etc..)<br><br> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow;<br><br> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img'];<br> <br> cfg = [];<br>% cfg.coordinates = 'spm'; % changed for version 5<br>% cfg.spmversion = 'spm8'; % changed for version 5<br> cfg.downsample = 4;<br> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri);<br> <br><br> % projecting the plot onto a surface...<br> cfg = [];<br> %cfg.coordinates = 'spm'; % changed for version 5<br> %cfg.coordinates = 'ctf'; % changed for version 5<br> cfg.coordinates = 'spm'; % changed back to spm for version 9<br> cfg.downsample = 4;<br> %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite)<br> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size<br> % <a href="http://cfg.name" target="_blank">cfg.name</a> = [filename]; % changed for version 6<br> %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite)<br> cfg.write= 'no'; % changed for version 6<br> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt);<br> <br> % this whole cfg and function call added for version 6 <br> cfg=[];<br> % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai'<br> % cfg.filename = filename without the extension<br>% cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr'<br>% cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use<br> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = [])<br> cfg.parameter='pow';<br> cfg.filename=filename; <br> cfg.filetype = 'spm';<br> cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6<br> % cfg.dataformat='nifti'; % added after first error message from vers 6<br> % commented out after 2nd error message from vers 6<br> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' <br> cfg.coordinates='spm';<br> ft_volumewrite(cfg,sourcetempIntN);<br><br> <br><br><br><br><div class="gmail_quote">On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br> <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Dear Jen,<br> <br> I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function?<br> <br> Thanks and best wishes<br> <br> Jan-Mathijs<div><div></div><div><br> <br> <br> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote:<br> <br> </div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> <div><div></div><div> Hello,<br> <br> While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format.<br> <br> I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images?<br> <br> Thanks!<br> <br></div></div> _______________________________________________<br> fieldtrip mailing list<br> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br> </blockquote> <br> Dr. J.M. (Jan-Mathijs) Schoffelen<br> Donders Institute for Brain, Cognition and Behaviour,<br> Centre for Cognitive Neuroimaging,<br> Radboud University Nijmegen, The Netherlands<br> <a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a><br> Telephone: 0031-24-3614793<br> <br> _______________________________________________<br> fieldtrip mailing list<br> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br> </blockquote></div><br> _______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote> </div></div></div><div><div></div><div class="h5"><br><div> <div style="word-wrap: break-word;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;"> <div>Dr. J.M. (Jan-Mathijs) Schoffelen </div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a></div> <div>Telephone: 0031-24-3614793</div></div></span></div> </div><br></div></div></div></div><div><div></div><div class="h5"><br>_______________________________________________<br> fieldtrip mailing list<br> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></div></div></blockquote></div><br> </blockquote></div><br> _______________________________________________<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></blockquote></div><br><div apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dr. J.M. (Jan-Mathijs) Schoffelen </div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><a href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: 0031-24-3614793</div></div></div> </div><br></div></body></html>