Hi Darren,
That is totally true - but I really wanted to keep the user interface as
simple as possible. I generally suggest that DARTEL is used for
simultaneously registering GM and WM, and that GM should be selected first.
I'll make sure that I include this requirement in the documentation though.
Usually, the objective is to spatially normalise GM. This is where the
activity is for fMRI and the usual data used for VBM studies.
Best regards,
-John
On Tuesday 26 May 2009 18:13, Gmail wrote:
> One other thing, spm_klaff appears to assume that any template
> conforms to the order of volumes in TPM.nii, which may not be correct,
> i.e., a white matter template
>
> -----
> Darren Gitelman, MD
> sent from my iPhone
>
> On May 26, 2009, at 11:28 AM, Darren Gitelman <[log in to unmask]>
>
> wrote:
> > John
> >
> > That solved the first problem, but I am still getting errors in the
> > normalization routine- as shown below. This led to the discovery of
> > what I think are a number of other problems caused by having 3D
> > instead of 4D data. See below.
> >
> > Warning: Matrix is singular to working precision.
> >
> >> In spm_klaff at 200
> >
> > In spm_dartel_norm_fun at 94
> > In matlabbatch/private/cfg_run_cm at 29
> > In cfg_util>local_runcj at 1363
> > In cfg_util at 699
> > In cfg_ui>MenuFileRun_Callback at 1139
> > In gui_mainfcn at 96
> > In cfg_ui at 53
> > Warning: Matrix is singular, close to singular or badly scaled.
> > Results may be inaccurate. RCOND = NaN.
> >
> >> In expm>PadeApproximantOfDegree at 123
> >
> > In expm at 39
> > In spm_klaff at 203
> > In spm_dartel_norm_fun at 94
> > In matlabbatch/private/cfg_run_cm at 29
> > In cfg_util>local_runcj at 1363
> > In cfg_util at 699
> > In cfg_ui>MenuFileRun_Callback at 1139
> > In gui_mainfcn at 96
> > In cfg_ui at 53
> > 1 NaN 0
> >
> > ----------
> > In spm_klaff.m
> >
> > The first problem caused by having 3D data is that loaddat doesn't
> > load Ng (or Nf) because loops such as starting at line 221
> > for k = 1:d(4)-1
> >
> > don't execute because d(4) -1 is 0. Also, the summing of the first
> > nd-1 volumes to create the last volume won't be right either, etc.
> >
> > Other questions about the code:
> >
> > Around line 45 it says [x,y ,zz] = ndgrid(1:dg(1),1:dg(2),0);
> > This will make zz all 0's, so I don't understand why at line 49 it is
> > added to z and if it really should be all 0's?
> >
> > A second problem occurs at lines 102-104.
> > x1 = M(1,1)*x + M(1,2)*y + M(1,3)*z + M(1,4);
> > y1 = M(2,1)*x + M(2,2)*y + M(2,3)*z + M(2,4);
> > z1 = M(3,1)*x + M(3,2)*y + M(3,3)*z + M(3,4);
> >
> > It turns out that for certain matrices, M, the values of x1, y1 or z1
> > can be very close to but not quite > 1. This causes the subsequent
> > lines (107-109)
> > msk = x1>=1 & x1<=df(1) &...
> > y1>=1 & y1<=df(2) &...
> > z1>=1 & z1<=df(3);
> >
> > to generate an empty msk.
> >
> > for example my Nf and Ng matrices resulted in an M matrix of
> > M =
> > 1.5000 0.0000 0.0000 -0.5000
> > 0.0000 1.5000 0.0000 -0.5000
> > -0.0000 -0.0000 1.5000 -0.5000
> > 0 0 0 1.0000
> >
> > This looks ok but the values of the 3rd row are actually
> > -0.0000000000000001
> > -0.0000000000000001
> > 1.5000000000000000
> > -0.5000000000000142
> >
> > which leads to a z1(1), for example, of: 0.9999999999999856. Since it
> > is < 1, msk ends up as all 0's.
> > so perhaps 102-104 should be rounded?
> >
> > x1 = round(M(1,1)*x + M(1,2)*y + M(1,3)*z + M(1,4));
> > y1 = round(M(2,1)*x + M(2,2)*y + M(2,3)*z + M(2,4));
> > z1 = round(M(3,1)*x + M(3,2)*y + M(3,3)*z + M(3,4));
> >
> > Messing around with all of this doesn't lead to optimum convergence of
> > dM and the resulting warped volumes end up being shifted and tiny...
> >
> > -----
> > Darren Gitelman
> >
> >
> >
> > On Tue, May 26, 2009 at 6:54 AM, John Ashburner <[log in to unmask]
> >
> > > wrote:
> >>
> >> Hi Darren,
> >> At around line 29, try changing the code to
> >>
> >> df = [size(Nf.dat),1,1]; % Dimensions of data
> >> dg = [size(Ng.dat),1,1]; % Dimensions of data
> >>
> >> The reason for the crash is that when the algorithm asks the size
> >> of a
> >> variable, MATLAB gives a vector of length equal to the number of
> >> dimensions.
> >> Usually, the data are 4D but yours were only 3D, so the 'df' variable
> >> contained only three elements and the code didn't know that the 4th
> >> (5th, 6th
> >> etc) dimensions should be 1.
> >>
> >> This will be fixed in the next updates.
> >>
> >> All the best,
> >> -John
> >>
> >> On Tuesday 26 May 2009 07:02, Darren Gitelman wrote:
> >>> Hi
> >>>
> >>> I am having difficulty using the "normalize to MNI space" function
> >>> of
> >>> dartel.
> >>>
> >>> The steps I've taken are as follows
> >>> 1) Import seg_sn.mat files
> >>> 2) Create template: I used just the rc1 files.
> >>> 3) Normalise to MNI space- Selected c1Template6. Selected the flow
> >>> fields and selected the rc1 images.
> >>>
> >>> It produces this error
> >>>
> >>> Running 'Normalise to MNI Space'
> >>> ** Affine registering "c1Template_6" with MNI space **
> >>> Failed 'Normalise to MNI Space'
> >>> Attempted to access df(4); index out of bounds because numel(df)=3.
> >>> In file "/usr/local/imsw/SPM/spm8/toolbox/DARTEL/
> >>> spm_klaff.m" (v3053),
> >>> function "spm_klaff" at line 32.
> >>> In file "/usr/local/imsw/SPM/spm8/toolbox/DARTEL/
> >>> spm_dartel_norm_fun.m"
> >>> (v3032), function "spm_dartel_norm_fun" at line 94.
> >>>
> >>> The following modules did not run:
> >>> Failed: Normalise to MNI Space
> >>>
> >>> thanks
> >>> -----
> >>> Darren Gitelman
|