Dear Matthieu,
On 05/01/16 20:35, Matthieu Vanhoutte wrote:
>>> In this case I see effectively that user defined global value is used
>>> to define g at l.750. But in this case, iGMsca = 9 and the definition of
>>> global scaling factor gSF is then gSF = ones(nScan,1) at l.847. So, I
>>> don't see where user-defined global value g is taken into account at l.855 ?
>> With the following settings:
>> spm.stats.factorial_design.globalc.g_user.global_uval = [...];
>> spm.stats.factorial_design.globalm.gmsca.gmsca_yes.gmscv = GM;
>> spm.stats.factorial_design.globalm.glonorm = 2;
>> I observe iGXcalc=2, iGloNorm=8 and iGMsca=8 such that line 838 is used
>> to define the scaling factors gSF (this involves setting 'normalisation'
>> to 'proportional').
> Sorry, I wanted to test and apply anatomical intensity normalization
> with e.g. grey cerebellum as reference ROI, in an alternative of global
> normalization. In this case, I will set the global calculation with the
> mean activity of cerebellum as "user-defined" value, is it right ?
>
> Then, I suppose that no normalization should set to "none" but how to
> rescale intensity with the user-defined value ? Simple divide each
> intensity voxel by the mean activity of cerebellum ?
> How to do this with SPM ?
This seems to correspond to the settings above. Compute your global
estimates with, eg, the spm_summarise function, and enter them in:
Global calculation > User > Global values
then change the normalisation setting to be:
Normalisation > Proportional
This will apply proportional scaling global normalisation.
Best regards,
Guillaume.
> Best regards,
> Matthieu
>
>>
>>> Moreover, at l.855 VY(i).pinfo(1:2,:) structure is modified but when I
>>> tried to write the new image rescaled with spm_write_vol the intensities
>>> haven't changed compared to initial image. Do I have to also multiply
>>> each voxel intensity by pinfo(1,1) to take into account intensity
>>> normalization ?
>> I guess it depends how you did this. What SPM does at line 855 is to
>> change the scaling factors of the images as stored in the SPM.mat
>> without changing the actual headers of the images themselves.
>> This means the data will be scaled appropriately when read using
>> SPM.xY.VY as in spm_spm.m l.567 but will still be unscaled when read in
>> any other way.
>>
>> Best regards,
>> Guillaume.
>>
>>
>>> Best regards,
>>> Matthieu
>>>
>>>
>>> All this code dates apparently from SPM99.
>>>
>>> Best regards,
>>> Guillaume.
>>>
>>>
>>> > Best regards,
>>> >
>>> > Matthieu
>>> >
>>> > 2015-12-18 17:52 GMT+01:00 Guillaume Flandin <[log in to unmask] <mailto:[log in to unmask]>
>>> > <mailto:[log in to unmask] <mailto:[log in to unmask]>>>:
>>> >
>>> > Dear Matthieu,
>>> >
>>> > the function you are looking at concerns first level fMRI so
>>> for PET
>>> > 'basic' models, you need to look at
>>> > spm12/config/spm_run_factorial_design.m
>>> > When using proportional scaling global normalisation, the
>>> global scaling
>>> > factor, gSF, is computed l.838 and applied to the data l.855.
>>> >
>>> > Best regards,
>>> > Guillaume.
>>> >
>>> >
>>> > On 18/12/15 15:33, Matthieu Vanhoutte wrote:
>>> > > Dear SPM experts,
>>> > >
>>> > > I have been searching for explicit formula of the global
>>> normalization
>>> > > with proportional scaling as it is used in SPM. I have found
>>> this code
>>> > > in "spm_fmri_spm_ui.m" :
>>> > >
>>> > > /%-Compute Global variate
>>> > >
>>> >
>>> %==========================================================================
>>> > > GM = 100;
>>> > > q = length(VY);
>>> > > g = zeros(q,1);
>>> > > fprintf('%-40s: ','Calculating globals')
>>> > %-#
>>> > > spm_progress_bar('Init',q,'Calculating globals');
>>> > > if spm_mesh_detect(VY)
>>> > > for i = 1:q
>>> > > dat = spm_data_read(VY(i));
>>> > > g(i) = mean(dat(~isnan(dat)));
>>> > > spm_progress_bar('Set',i)
>>> > > end
>>> > > else
>>> > > for i = 1:q
>>> > > g(i) = spm_global(VY(i));
>>> > > spm_progress_bar('Set',i)
>>> > > end
>>> > > end
>>> > > spm_progress_bar('Clear');
>>> > > fprintf('%30s\n','...done')
>>> > %-#
>>> > >
>>> > > %-Scale if specified (otherwise session specific grand mean
>>> scaling)
>>> > >
>>> >
>>> %--------------------------------------------------------------------------
>>> > > gSF = GM./g;
>>> > > if strcmpi(SPM.xGX.iGXcalc,'none')
>>> > > for i = 1:nsess
>>> > > gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row));
>>> > > end
>>> > > end
>>> > >
>>> > > %-Apply gSF to memory-mapped scalefactors to implement scaling
>>> > >
>>> >
>>> %--------------------------------------------------------------------------
>>> > > for i = 1:q
>>> > > SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:) *
>>> gSF(i);
>>> > > if spm_mesh_detect(VY)
>>> > > SPM.xY.VY(i).private.private.data{1}.data.scl_slope
>>> = ...
>>> > >
>>> SPM.xY.VY(i).private.private.data{1}.data.scl_slope *
>>> > gSF(i);
>>> > > SPM.xY.VY(i).private.private.data{1}.data.scl_inter
>>> = ...
>>> > >
>>> SPM.xY.VY(i).private.private.data{1}.data.scl_inter *
>>> > gSF(i);
>>> > > else
>>> > > SPM.xY.VY(i).private.dat.scl_slope = ...
>>> > > SPM.xY.VY(i).private.dat.scl_slope * gSF(i);
>>> > > SPM.xY.VY(i).private.dat.scl_inter = ...
>>> > > SPM.xY.VY(i).private.dat.scl_inter * gSF(i);
>>> > > end
>>> > > end
>>> > >
>>> > > %-Place global variates in xGX
>>> > >
>>> >
>>> %--------------------------------------------------------------------------
>>> > > SPM.xGX.sGXcalc = 'mean voxel value';
>>> > > SPM.xGX.sGMsca = 'session specific';
>>> > > SPM.xGX.rg = g;
>>> > > SPM.xGX.GM <http://SPM.xGX.GM> <http://SPM.xGX.GM>
>>> <http://SPM.xGX.GM> = GM;
>>> > > SPM.xGX.gSF = gSF;
>>> > > /
>>> > > /-------------------------------------/
>>> > >
>>> > > I understood global mean is computed in "g" variable but
>>> didn't see
>>> > > where it is used after on the data volume in case of
>>> proportional
>>> > scaling ?
>>> > >
>>> > > Is the formula simply divided each intensity voxel of the image
>>> > per the
>>> > > global mean "g" ?
>>> > >
>>> > > Best regards,
>>> > > Matthieu
>>> >
>>> > --
>>> > Guillaume Flandin, PhD
>>> > Wellcome Trust Centre for Neuroimaging
>>> > University College London
>>> > 12 Queen Square
>>> > London WC1N 3BG
>>> >
>>> >
>>>
>>> --
>>> Guillaume Flandin, PhD
>>> Wellcome Trust Centre for Neuroimaging
>>> University College London
>>> 12 Queen Square
>>> London WC1N 3BG
>>>
>>>
>
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|