Print

Print


Dear Guillaume,


2016-01-05 16:14 GMT+01:00 Guillaume Flandin <[log in to unmask]>:
Dear Matthieu,

On 04/01/16 12:01, Matthieu Vanhoutte wrote:
> 1) If I well understood, when using global normalization with
> proportional scaling the overall grand mean scaling is always used with
> GM = 50 per default ? (l. 803)

unless you specify a different value in:
  Global normalisation > Overall grand mean scaling > Yes > Grand mean
scaled value
It will then be used to define variable GM at l.795 or l.801.

> 2) I couldn't find, in case of a user-defined global calculation, where
> this user-defined factor is divided/applied on the image ?

If you specify your own global effects values in:
  Global calculation > User > Global values
they will then be used to define variable g at l.750. This variable is
then used to define the global scaling factor gSF and applied to the
data, as mentioned before, at l.855.

 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 ?

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 ?

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]>>:
>
>     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>      = 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