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