<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Jen,<div><br></div><div>Thanks for sending the code.</div><div>What is the actual error message you are getting?</div><div><br></div><div>Best wishes,</div><div><br></div><div>Jan-Mathijs</div><div><br></div><div><br><div><div>On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote:</div><br class="Apple-interchange-newline"><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">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">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 class="h5"><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 class="h5"> 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">fieldtrip@donders.ru.nl</a><br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-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; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><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></span></div></span> </div><br></div></body></html>