Reply-To: | | [log in to unmask][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 = ... >>> 5U‡Ò |