[FieldTrip] I think you solved the problem

Hanneke van Dijk Hanneke.vanDijk at med.uni-duesseldorf.de
Fri Apr 15 12:38:56 CEST 2011


sorry, forgot to attach pic2

On Fri, Apr 15, 2011 at 11:34 AM, Hanneke van Dijk <
Hanneke.vanDijk at med.uni-duesseldorf.de> wrote:

> Dear Jan and Jan-Mathijs,
>
> Thanks for working on this problem! I'm testing it for data recorded with
> the 'old' neuromag 122 system. I'm using the script that Jan attached to a
> previous e-mail, and the fieldtrip version that was released yesterday. The
> first question that I have is:
>
> What to do if you don't have fiducial information from the neuromag
> software? I could use ft_volume_realign with cfg.method = 'interactive' and
> point the fiducials out and swap the y and x axes. But in what coordinate
> system am I then, and in what coordinate system should I move on?
>
> second,
>
> My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller
> unit then the grid and grad. You can't even see it in the headmodelplot (it
> is a small dot somewhere in the middle). I don't know what happened there.
>
> third,
>
> If you look at the picture I attached the grid is not in the centre of the
> helmet (pic1 from the top down), and very low (pic2 looking from the left).
> I don't know how to solve that. I at least think the subject was not in the
> helmet that way!
>
> Groetjes Hanneke
>
> --------------------------------------------------
> Dr. Hanneke van Dijk
> Institut für Klinische Neurowissenschaften und Medizinische Psychologie
> Gebäude-Nr.: 23.02
> Ebene: 03 Zimmer-Nr.: 47
> Tel.:  +49 211-81-13074
> Mail : hanneke.vandijk at med.uni-duesseldorf.de
>
> http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html
>
>
> On Thu, Apr 14, 2011 at 9:31 AM, <Jan.Hirschmann at med.uni-duesseldorf.de>wrote:
>
>>  Dear Jan-Mathijs,
>>
>>
>>
>> sure, I will do that. I have tested one head model with
>> ft_dipole_simulation and beamforming and it looks good (at least when I
>> simulate two conditions and subtract sources the right location comes out).
>> So I guess we (and maybe others) will use the new procedure now.
>>
>>
>>
>> Best,
>>
>> jan
>>
>>
>>  ------------------------------
>>
>> *Von:* fieldtrip-bounces at donders.ru.nl [mailto:
>> fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen
>> *Gesendet:* Mittwoch, 13. April 2011 16:57
>> *An:* Email discussion list for the FieldTrip project
>> *Betreff:* Re: [FieldTrip] I think you solved the problem
>>
>>
>>
>> Dear Jan,
>>
>>
>>
>> No problem. Thanks for the script. If you feel up to it, you are kindly
>> invited to update the documentation on the fieldtrip wiki as well. If I
>> recall correctly, at some point Hanneke added some documentation about how
>> to create MNI-based dipole grids for neuromag data. A lot of the
>> intermediate steps have now become obsolete and this part of the wiki can be
>> substantially cleaned.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Jan-Mathijs
>>
>>
>>
>>
>>
>> On Apr 13, 2011, at 2:31 PM, <Jan.Hirschmann at med.uni-duesseldorf.de> <
>> Jan.Hirschmann at med.uni-duesseldorf.de> wrote:
>>
>>
>>
>>   Dear Jan-Mathijs,
>>
>>
>>
>> I think we solved the problem. Everthing is like you said in the first
>> place. ft_volumerealign and ft_volumesegment should be called with
>> cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel
>> coordinates read from the Neuromag GUI x and y should be swapped. For anyone
>> interested I attach a script that is meant to be easy-to-use for beginners.
>>
>>
>>
>> Thank you very much for your time!
>>   ------------------------------
>>
>> *Von:* fieldtrip-bounces at donders.ru.nl [
>> mailto:fieldtrip-bounces at donders.ru.nl <fieldtrip-bounces at donders.ru.nl>]
>>  *Im Auftrag von *jan-mathijs schoffelen
>> *Gesendet:* Dienstag, 12. April 2011 21:18
>> *An:* Email discussion list for the FieldTrip project
>> *Betreff:* Re: [FieldTrip] I think you solved the problem
>>
>>
>>
>> Dear Jan,
>>
>>
>>
>> I suspect that your mri, as it comes out of ft_read_mri is already
>> coregistered in neuromag space. After your realignment and after replacing
>> mri.transform with real_mri.transform, the coordinate axes in your pic1 look
>> strange. This I think causes the 'dropped pocket change'.
>>
>> What happens if you skip the ft_volumerealign step and call
>> ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or,
>> for what it's worth, without cfg.coordsys; in this case you will be able to
>> verify the coordinate system)?
>>
>> Alternatively, if this doesn't work, could you replace mri.transform by
>> eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with
>> cfg.coordsys = 'neuromag' and no further tampering with transformation
>> matrices?).
>>
>>
>>
>> Thanks
>>
>>
>>
>> JM
>>
>>
>>
>>
>>
>> On Apr 12, 2011, at 8:49 PM, <Jan.Hirschmann at med.uni-duesseldorf.de> <
>> Jan.Hirschmann at med.uni-duesseldorf.de> wrote:
>>
>>
>>
>>
>>    Dear Jan-Mathijs,
>>
>>
>>
>> sorry, I think I was a bit too enthusiastic when I said everything worked
>> out wonderfully. It worked only once. After an afternoon of confusion I
>> concluded that on my first try I must have misspelled
>> cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and
>> ft_volumesegment. In fact, the segmentation looks really bad with these
>> settings. What works for me is written underneath:
>>
>>
>>
>> mri  = ft_read_mri('….fif');
>>
>> hdr=ft_read_header('…fif');
>>
>> mri.anatomy=double(mri.anatomy);
>>
>>
>>
>> %this is taken from the Neuromag GUI for MRI-MEG Integration
>>
>> cfg=[];
>>
>> cfg.fiducial.rpa=[136.35   142.80    31.96];
>>
>> cfg.fiducial.nas=[47.84   101.80   100.10];
>>
>> cfg.fiducial.lpa=[139.22   146.17   162.69];
>>
>>
>>
>> %go from neuromag voxel to neuromag head coordinates
>>
>> cfg.coordsys='neuromag';
>>
>> cfg.method='fiducial';
>>
>> real_mri=ft_volumerealign(cfg,mri);
>>
>>
>>
>> %taking real_mri with its coordsys field will not work, so I take mri
>>
>> mri.transform=real_mri.transform;
>>
>>
>>
>> cfg                = [];
>>
>> cfg.keepintermediate = 'no';
>>
>> cfg.write = 'no';
>>
>> segmentedmri   = ft_volumesegment(cfg, mri);
>>
>>
>>
>>
>>
>> Before segmentation the function shows some kind of brain (pic 1). When
>> segmentation is done the segmented brain looks good (pic 2) but the brain
>> does not fit the helmet (pic 3). It is looking at its feet as if it dropped
>> some pocket change. Do you know what is going on?
>>
>>
>>
>> Thanks,
>>
>> jan
>>
>>
>>   ------------------------------
>>
>> *Von:* fieldtrip-bounces at donders.ru.nl [
>> mailto:fieldtrip-bounces at donders.ru.nl <fieldtrip-bounces at donders.ru.nl>]
>>  *Im Auftrag von *jan-mathijs schoffelen
>> *Gesendet:* Dienstag, 12. April 2011 12:11
>> *An:* Email discussion list for the FieldTrip project
>> *Betreff:* Re: [FieldTrip] I think you solved the problem
>>
>>
>>
>> Dear Jan,
>>
>>
>>
>> Apart from not being properly aligned, the segmentation looks a bit
>> strange to me. I suspect that not everything went well here ;o).
>>
>> Could you try the following:
>>
>>
>>
>> specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign
>> and in your call to ft_volumesegment. The cfg.coordinates for
>> ft_volumesegment has to be removed (actually it is a deprecated option). The
>> idea now is that mri-structures in fieldtrip can have a coordsys field,
>> which allows for more transparent use of the different head coordinate
>> system conventions. This takes away the need for intermediately
>> coregistering the MRI in 'ctf'-convention, and would also take away your
>> need to call headcoordinates later on.
>>
>>
>>
>> Best wishes,
>>
>>
>>
>> Jan-Mathijs
>>
>>
>>
>>
>>
>> On Apr 12, 2011, at 11:07 AM, <Jan.Hirschmann at med.uni-duesseldorf.de> <
>> Jan.Hirschmann at med.uni-duesseldorf.de> wrote:
>>
>>
>>
>>
>>
>>     Dear fieldtrip experts,
>>
>>
>>
>> I have two questions regarding head model creation. As noted on this
>> thread, the volumesegment function was updated and I tested it for our
>> Neuromag data. The segmentation is performed, but unfortunately it is not
>> aligned with the MRI in my case. Here is the code I am using, the fieldtrip
>> is from 9th April 2011.
>>
>>
>>
>> %read mri
>>
>> mri                = ft_read_mri(subject_files.fiff_mri);
>>
>> mri.anatomy=double(mri.anatomy);
>>
>>
>>
>> %these are the fiducials for this subject taken from the Neuromag GUI for
>> coregistration
>>
>> cfg=[];
>>
>> cfg.fiducial.rpa=[136.35   142.80    31.96];
>>
>> cfg.fiducial.nas=[47.84   101.80   100.10];
>>
>> cfg.fiducial.lpa=[139.22   146.17   162.69];
>>
>>
>>
>> %define the head coordinate system according to CTF conventions
>>
>> cfg.method='fiducial';
>>
>> real_mri=ft_volumerealign(cfg,mri);
>>
>>
>>
>> %segment
>>
>> cfg                = [];
>>
>> cfg.template       = '/data/apps/spm/spm8/templates/T1.nii';
>>
>> cfg.coordinates    = 'ctf';
>>
>> cfg.keepintermediate = 'no';
>>
>> segmentedmri     = ft_volumesegment(cfg, real_mri);
>>
>>
>>
>> %plot white matter
>>
>> test=segmentedmri;
>>
>> test.anatomy=real_mri.anatomy;
>>
>> cfg=[];
>>
>> cfg.funparameter='white';
>>
>> ft_sourceplot(cfg,test); %see attached picture
>>
>>
>>
>> The other issue regards back-transformation from CTF to Neuromag
>> coordinates, which is necessary to make the head model fit the sensors. My
>> idea was to create an appropriate transformation matrix like this.
>>
>>
>>
>> cd /net/avidya/storage/home/jan/fieldtrip-20110409/private
>>
>> ctfmat=headcoordinates(nas,lpa,rpa,'ctf');
>>
>> nmmat=headcoordinates(nas,lpa,rpa,'neuromag');
>>
>> ctf_to_nm=nmmat/ctfmat;
>>
>>
>>
>>
>>
>> And then to use it on the head model to bring it back into Neuromag
>> coordinates:
>>
>>
>>
>> %create single shell, realistic headmodel
>>
>> cfg                = [];
>>
>> hdm                = ft_prepare_singleshell(cfg,segmentedmri);
>>
>>
>>
>> % transformation of headmodel into Neuromag space
>>
>> hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous');
>>
>>
>>
>> Does this survive a sanity check?
>>
>>
>>
>> Best regards and thanks a lot,
>>
>>
>>
>> Jan
>>
>>
>>
>>
>>    ------------------------------
>>
>> *Von:* fieldtrip-bounces at donders.ru.nl [
>> mailto:fieldtrip-bounces at donders.ru.nl <fieldtrip-bounces at donders.ru.nl>]
>>  *Im Auftrag von *Jen Whitman
>> *Gesendet:* Montag, 28. Februar 2011 22:32
>> *An:* Email discussion list for the FieldTrip project
>> *Betreff:* [FieldTrip] I think you solved the problem
>>
>>
>>
>> I just checked, and when I re-ran my segmentation script with the new
>> Fieldtrip in order to use an spm8 template image, coordinates got reversed.
>> When I take out the calls to flipdim, they look fine (see attached
>> screenshots). That certainly explains the meaningless results I was getting!
>>
>> Thanks for figuring that out,
>>
>> Jen
>>
>> On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen <
>> jan.schoffelen at donders.ru.nl> wrote:
>>
>> Hi Jen,
>>
>>
>>
>> At first glance I have a comment on your script. You may need to
>> explicitly check the alignment of your segmented volume and the original
>> anatomy. A while a go some changes were made to ft_volumesegment, taking
>> away the need to do the flipdim(flipdim...  operations. I have posted this
>> on the discussion list last January, but you may not have noticed.
>>
>> Anyway, if you now have used a recent version of FieldTrip for your
>> segmentation both the location of your dipole grid, and the volume conductor
>> model will not be adequately coregistered with the data, which may lead to
>> funky results to begin with. That's most likely not related to the filetype
>> in which the volumes are saved for later use.
>>
>>
>>
>> Best wishes,
>>
>>
>>
>> Jan-Mathijs
>>
>>
>>
>>
>>
>>
>>
>> On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote:
>>
>>
>>
>>
>>
>>
>>   Hello Jan,
>>
>> When calling volumesegment, I specified 'ctf' as the coordinate system.
>> The function I wrote to call volumesegment and prepare_singleshell for each
>> subject and save the results is pasted below, with a couple of  comments
>> added for clarity.
>> Over the weekend I tried specifying the coordinate system in the call to
>> ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the
>> lines that said cfg.spmversion = 'spm8'; before calling a function. However,
>> that created worse results, as each plot involved stripes of activation and
>> empty voxels, suggesting that 'ctf' was not the correct coordinate system to
>> specify.
>>
>> Thanks for the attached script. Looking in that the comments in that, I
>> suspect that the solution to my problems will be to specify my filetype as
>> nifti_img rather than nifti. I'll let you know how that goes.
>>
>> Jen
>>
>>
>> ------------------------------------------------------------------------------------------------------------
>> % the variable subj is simply a string consisting of a subject number
>> (e.g. 's05') which can be a folder name or part of a filename
>> function [vol mri segmentedmri
>> segmentedmriF]=call_volume_segment_function_spm8(subj)
>> cfg.spmversion = 'spm8';
>> cfg.template   = '/home/woodwardlab/spm8/templates/EPI.nii';
>> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc';
>> cfg.name=[subj '_volseg'];
>> cfg.write='yes';
>> cfg.smooth='no';
>> cfg.coordinates='ctf';
>> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter
>> and mriViewer software, after fiducials were marked
>> segmentedmri = volumesegment(cfg, mri);
>> segmentedmriF = segmentedmri;
>> segmentedmriF.gray  = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1);
>> segmentedmriF.white =
>> flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1);
>> segmentedmriF.csf   = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1);
>> segmentedmriF.transform = mri.transform;
>> segmentedmriF.anatomy   = mri.anatomy;
>> cfg = [];
>> cfg.spmversion = 'spm8';
>> vol = prepare_singleshell(cfg, segmentedmriF);
>> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF
>> vol'])
>>
>>
>>
>>
>>
>>    On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen <
>> jan.schoffelen at donders.ru.nl> wrote:
>>
>> Dear Jen,
>>
>>
>>
>> I do not manage to reproduce your issue, when only focussing on the
>> ft_volumewrite and visualization part of your pipeline. See attached script,
>> and yet an updated version of ft_volumewrite which you need to (hopefully)
>> draw the same conclusion as I did.
>>
>> Yet, I only now realize that your question may pertain to the entire
>> pipeline. It could be that something is going wrong there.
>>
>> I only see now that in the part of your script of which you reported that
>> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling
>> ft_volumenormalise. I assume this is correct, because the coordinate system
>> your source-reconstructed data lives in, is according to the CTF-convention,
>> and not according to the SPM-convention. On the other hand, the template for
>> the spatial normalization lives in the SPM-coordinate system. In order for
>> the spatial normalization to work OK, Fieldtrip tries to convert from one
>> coordinate system to the other (once again, this is appropriate behaviour),
>> before doing the actual normalization. It seems that at least in the script
>> you sent along, in the final (not working version), you specified
>> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is
>> probably wrong.
>>
>> Another important point that should be mentioned, is that the coordinate
>> systems in which the functional data and the anatomical data live should be
>> the same for the ft_sourceinterpolate to make sense. In other words, if your
>> source reconstructed images are defined on a 3D grid of positions in
>> CTF-space, the mri.transform of your anatomy should describe a
>> transformation from voxel to CTF-space.
>>
>> I think you may want to revisit step by step this part of the pipeline; I
>> don't think the problem lies in the writing.
>>
>> A final possibility of course is that Mricron is misbehaving...
>>
>>
>>
>> Best,
>>
>>
>>
>> Jan-Mathijs
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote:
>>
>>
>>
>>
>>
>>
>>   Hi Jan,
>>
>> 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).
>>
>> 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?
>>
>> Thanks again for your help,
>>
>> Jen
>>
>> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman <jenwhitman at gmail.com>
>> wrote:
>>
>> Great, thanks!
>>
>> I'll start the analysis with your new script today and will let you know
>> how it works out.
>>
>> Jen
>>
>> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen <
>> jan.schoffelen at donders.ru.nl> wrote:
>>
>>    Dear Jen,
>>
>>
>>
>> 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.
>>
>>
>>
>> Best wishes,
>>
>>
>>
>> Jan-Mathijs
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote:
>>
>>
>>
>>
>> Dear Jan,
>>
>> 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.
>>
>> Jen
>>
>>
>> %%%%%%%% this code generated spm2-compatible images which did work
>> (producing results that made sense).
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>>     sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./
>> sourcePre.avg.pow;
>>
>>     cfg = [];
>>     cfg.downsample = 2;
>>     sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri);
>>
>>     % projecting the plot onto a surface...
>>     cfg = [];
>>     cfg.coordinates  = 'ctf';
>>     cfg.template     = '/home/common/matlab/spm2/templates/T1.mnc'; %this
>> template is in MNI coordinates
>>     sourcetempIntN = volumenormalise(cfg, sourcetempInt);
>>
>>     filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f)
>> 'HzWin' int2str(win) 'width750ms'];
>>     cfg=[];
>>     cfg.parameter     = 'avg.pow'; % string, describing the functional
>> data to be processed, e.g. 'pow', 'coh' or 'nai'
>>     cfg.filename      = [filename '.img']; %'testimageoutput_alphafreq'; %
>> filename without the extension
>>     cfg.filetype      = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr'
>>     cfg.coordinates   = 'spm'; %'spm, 'ctf' or empty for interactive
>> (default = [])
>>     cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8',
>> 'int16', 'int32', 'float' or 'double'
>>
>>     volumewrite(cfg, sourcetempIntN)
>>
>>
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %%%%% this code below hasn't worked yet...
>>
>> % I added    cfg.spmversion = 'spm8';
>> % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis,
>> % and in the call to prepare_singleshell after calling volumesegment
>>
>> % I've also ensured that spm8 is the only spm version in my path, even in
>> % the fieldtrip/external folder, and ensured that spm8 is installed
>> properly
>> % (files compiled correctly, etc..)
>>
>>     sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./
>> sourcePre.avg.pow;
>>
>>     filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f)
>> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img'];
>>
>>     cfg = [];
>> %     cfg.coordinates  = 'spm'; % changed for version 5
>> %     cfg.spmversion = 'spm8'; % changed for version 5
>>     cfg.downsample = 4;
>>     sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri);
>>
>>
>>     % projecting the plot onto a surface...
>>     cfg = [];
>>     %cfg.coordinates  = 'spm'; % changed for version 5
>>     %cfg.coordinates  = 'ctf'; % changed for version 5
>>     cfg.coordinates = 'spm'; % changed back to spm for version 9
>>     cfg.downsample = 4;
>>     %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets
>> specified in volumewrite)
>>     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
>>     % cfg.name = [filename]; % changed for version 6
>>     %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes'
>> there was no subsequent call to volumewrite)
>>     cfg.write= 'no';   % changed for version 6
>>     sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt);
>>
>>     % this whole cfg and function call added for version 6
>>     cfg=[];
>>     %   cfg.parameter     = string, describing the functional data to be
>> processed, e.g. 'pow', 'coh' or 'nai'
>> %   cfg.filename      = filename without the extension
>> %   cfg.filetype      = 'analyze', 'spm', 'vmp' or 'vmr'
>> %   cfg.vmpversion    = 1 or 2 (default) version of the vmp-format to use
>> %   cfg.coordinates   = 'spm, 'ctf' or empty for interactive (default =
>> [])
>>     cfg.parameter='pow';
>>     cfg.filename=filename;
>>     cfg.filetype = 'spm';
>>     cfg.spmversion = 'SPM8'; % capitalized after first error message from
>> vers 6
>> %   cfg.dataformat='nifti';  % added after first error message from vers 6
>>                                  % commented out after 2nd error message
>> from vers 6
>>     %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to
>> specify unless cfg.filetyp='vmp'
>>     cfg.coordinates='spm';
>>     ft_volumewrite(cfg,sourcetempIntN);
>>
>>
>>
>>
>>
>>
>>
>>    On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen <
>> jan.schoffelen at donders.ru.nl> wrote:
>>
>> Dear Jen,
>>
>> 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?
>>
>> Thanks and best wishes
>>
>> Jan-Mathijs
>>
>>
>>
>>
>> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote:
>>
>>  Hello,
>>
>> 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.
>>
>> 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?
>>
>> Thanks!
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>> J.Schoffelen at donders.ru.nl
>> Telephone: 0031-24-3614793
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> <misalignment.png>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>> <pic1.png><pic2.png><pic3.png>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>> <headmodel_with_neuromag.m>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>> Dr. J.M. (Jan-Mathijs) Schoffelen
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>>
>> Telephone: 0031-24-3614793
>>
>>
>>
>> _______________________________________________
>> 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/20110415/a1f45a9e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic2.jpg
Type: image/jpeg
Size: 19281 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110415/a1f45a9e/attachment.jpg>


More information about the fieldtrip mailing list