Which way is correct? <Re: volumerealign error>
Jim Li
megjim1 at GMAIL.COM
Wed Sep 15 21:55:33 CEST 2010
(a) Aha, we found that, even though "mri" has a field called "anatomy",
running "[segmentedmri]=ft_volumesegment(cfg, mri)" will drop that"anatomy"
field for "segmentedmri" , thus causing trouble for subsequent
implementation of "ft_volumerealign(cfg, segmentedmri)". That's why we got
the error message.
By adding the "anatomy" field to "segmentedmri" before running
""ft_volumerealign(cfg, segmentedmri)", the problem can be solved.
Here is the full script that worked now:
-----------------------------------------
mri = ft_read_mri('../2_mri.img');
cfg = [];
cfg.write = 'no';
cfg.coordinates = 'spm';
[segmentedmri] = ft_volumesegment(cfg, mri);
segmentedmri.anatomy= mri.anatomy; % a newly added line that solved the issue
cfg = [];
cfg.method = 'interactive';
[realigned_mri] = ft_volumerealign(cfg, segmentedmri)
--------------------------------------------
(b) Interestingly, if we swap the above steps (i.e. do "ft_volumerealign"
first, then "ft_volumesegment"), it also works fine. Here is the full script
that works, too:
-----------------------------------------
mri = ft_read_mri('../2_mri.img');
cfg = [];
cfg.write = 'no';
cfg.coordinates = 'spm';
[mri_realign] = ft_volumerealign(cfg, mri)
cfg = [];
cfg.write = 'no';
cfg.coordinates = 'spm';
[segmentedmri] = ft_volumesegment(cfg, mri_realign);
-----------------------------------------
My question is: given these two ways to process data, which one is the
correct way? Do "ft_volumesegment" first, then "ft_volumerealign" (i.e. use
scripts in (a)) ? Or do "ft_volumerealign" first, then "ft_volumesegment"
(i.e. use scripts in (b))?
Thanks.
Jim
On Mon, 13 Sep 2010 21:02:30 +0200, Jim Li <megjim1 at GMAIL.COM> wrote:
>Hello,
>
>I tried the same commands in a Windows Server 2008 PC with a R2009b MATLAB
>that has all 4 toolboxes recommended by Fieldtrip. And it has the latest
>SPM8 and Fieldtrip. I still got the same error message.
>
>Any suggestion how to fix the problem? Should I run "ft_volumerealign"
>first on the "mri" structure, then run "ft_volumesegment" on this realigned
>data?
>
>Thanks,
>
>Jim
>
>On Fri, 10 Sep 2010 20:09:24 +0200, Jim Li <megjim1 at GMAIL.COM> wrote:
>
>>Dear all,
>>
>>Can anyone tell me what to do when the following error happens?
>>
>>1) First I ran the following code:
>>-------------
>>mri = ft_read_mri('../2_mri.img');
>>cfg = [];
>>cfg.write = 'no';
>>cfg.coordinates = 'spm'; %x/ears is ctf; y/ant com is spm
>>[segmentedmri] = ft_volumesegment(cfg, mri);
>>--------------
>>
>>And the output looks like this :
>>======================
>>the input is volume data with dimensions [256 256 150]
>>assuming that the input MRI is already approximately aligned with SPM
>>coordinates
>>performing the segmentation on the specified volume
>>Warning: File
>>'C:\Users\x\AppData\Local\Temp\2\tpf8737ef1_d83d_410c_876b_4cf1db904445.mat'
>>not found.
>>> In ft_volumesegment at 297
>>=====================
>>
>>2) Then I did this:
>>-------------
>>cfg = [];
>>cfg.method = 'interactive';
>>[realigned_mri] = ft_volumerealign(cfg, segmentedmri)
>>--------------
>>
>>And the output error message is:
>>================
>>the input is volume data with dimensions [256 256 150]
>>??? Index exceeds matrix dimensions.
>>
>>Error in ==> ft_volumerealign at 102
>> cfg.parameter = cfg.parameter{1};
>>================
>>
>>How can this error be fixed?
>>
>>FYI, my PC is a 64bit machine with Windows Server 2008 R2 standard. My
>>matlab is Version 7.5 but it only has Statistics Toolbox. And I installed
>>SPM8. Could it be that I need other MATLAB toolboxes like "Signal
>>processing toolbox"?
>>
>>Thanks a lot,
>>
>>Jim
>>
>>----------------------------------
>>The aim of this list is to facilitate the discussion between users of the
>FieldTrip toolbox, to share experiences and to discuss new ideas for MEG
>and EEG analysis. See also
>http://listserv.surfnet.nl/archives/fieldtrip.html and
>http://www.ru.nl/neuroimaging/fieldtrip.
>
>----------------------------------
>The aim of this list is to facilitate the discussion between users of the
FieldTrip toolbox, to share experiences and to discuss new ideas for MEG
and EEG analysis. See also
http://listserv.surfnet.nl/archives/fieldtrip.html and
http://www.ru.nl/neuroimaging/fieldtrip.
----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
More information about the fieldtrip
mailing list