It was just a problem with the informational message. This should work
drg
%=================================================
function setspmmask(th)
% SETSPMMASK sets the threshold mask to the specified value or -Inf
% if no value supplied. Particularly needed for perfusion data.
global defaults
% set the global value
if nargin == 1
defaults.mask.thresh = th;
else
defaults.mask.thresh = -Inf;
th = -Inf;
end
% clear the local copy of the global defaults.
clear defaults
% reload the global
global defaults
% check if it's been changed.
if defaults.mask.thresh == th;
fprintf('\nAnalysis masking threshold set to %0.2f.\n',th)
else
fprintf('\nProblem setting analysis masking threshold.\n')
end
%=================================================
At 11:17 AM 2/16/2005, [log in to unmask] wrote:
>Dear Darren, many thanks for your help.
>
>I tried to run the setspmmask program but I got:
>
> >> setspmmask(0.5)
>
>Problem setting analysis masking threshold.
> >>
>
>I think it does the same as changing the spm_fmri_spm_ui.m code manually,
>right?
>
>In relation to the addimagemask, if I understood correct, this is to change
>spm.mat after estimation, to exclude for example "non-brain" voxels and this
>is especially important if I change I reduce the threshold before
>estimation.
>Ok, I will try do it.
>
>
>Another solution would be to explicitly specify which voxels to be
>included in
>the statistics, for instance, changing the mask image file for one containing
>all gray matter voxels, and then estimating GLM from it. Do you have any
>suggestion about this?
>
>Mirtes
>
>
>
>
>Citando Darren Gitelman <[log in to unmask]>:
>
> > Dear Mirtes:
> >
> > I think the code below will help with both issues. Yes, if you set the
> > masking threshold to a lower value you will include more voxels. You don't
> > need to change code elsewhere. Try running the setspmmask program. when
> run
> > without any inputs it sets the mask to -Inf. Otherwise you can call it
> with
> > the threshold you want, e.g., setspmmask(0.5).
> >
> > As to the suggestion by Alex regarding an explicit threshold you can run
> > the addimagemask code. This adds an explicit mask to an spm analysis. Note
> > that when you make the mask, make sure you smooth it. Jagged edges can
> > unecessarily increase the resel count in your images and increase the
> > p-values.
> >
> > cheers,
> > Darren
> >
> > %=====================================================
> > function setspmmask(th)
> > % SETSPMMASK sets the threshold mask to the specified value or -Inf
> > % if no value supplied. Particularly needed for perfusion data.
> >
> > global defaults
> >
> > % set the global value
> > if nargin == 1
> > defaults.mask.thresh = th;
> > else
> > defaults.mask.thresh = -Inf;
> > end
> >
> > % clear the local copy of the global defaults.
> > clear defaults
> >
> > % reload the global
> > global defaults
> >
> > % check if it's been changed.
> > if defaults.mask.thresh == -Inf;
> > fprintf('\nAnalysis masking threshold set to -Inf.\n')
> > else
> > fprintf('\nProblem setting analysis masking threshold.\n')
> > end
> > %=====================================================
> >
> >
> > %=====================================================
> > % ADDIMAGEMASK
> > % Add an explicit image mask to an spm structure. When used with -Inf mask
> > % above, avoids seeing every non-brain voxel.
> >
> > % Get an SPM.mat file and directory
> > swd = spm_str_manip(spm_get(1,'SPM.mat','Select SPM.mat file'),'H');
> >
> > %-Load SPM.mat
> > %--------------------------------------------------
> > load(fullfile(swd,'SPM.mat'));
> >
> > VM = spm_get(1,'IMAGE','Select Masking Image');
> > if isempty(VM)
> > return;
> > end
> >
> > % put mapped volume into maksing structure.
> > SPM.xM.VM = spm_vol(VM);
> >
> > % modify the mask description
> > SPM.xM.xs.Masking = [SPM.xM.xs.Masking, '+image mask'];
> >
> > % save it
> > save(fullfile(swd,'SPM.mat'),'SPM')
> >
> > % get the last path directory
> > [pth fn ext vr]=fileparts(swd);
> >
> > fprintf('Image mask added to %s/SPM.mat\n',fn);
> >
> > %=====================================================
> >
> >
> > At 06:13 AM 2/16/2005, Mirtes Fortes wrote:
> > >Hi
> > >
> > >I had some problems with the mask created in a fixed-effect multi-subject
> > >analysis which excluded many important voxels. After looking for a
> solution
> > in
> > >old messages of this list I found a message wrote by Karl in that he
> > suggests
> > >to reduce the grey matter threshold before estimating the SPm.mat.
> > >
> > >Is it sufficient to change directly the SPM code ( spm_fmri_spm_ui.m at
> > line
> > >413) which is originally:
> > >
> > >%-Masking structure automatically set to 80% of mean
> > >%=====================================================
> > >try
> > > TH = g.*gSF*defaults.mask.thresh;
> > >catch
> > > TH = g.*gSF*0.8;
> > >
> > >for example to
> > >
> > >
> > > TH = g.*gSF*0.5;
> > >
> > >
> > >or is it necessary to change other codes also?
> > >
> > >
> > >Thanks in advance,
> > >Mirtes
> >
> >
> > -------------------------------------------------------------------------
> > Darren R. Gitelman, M.D.
> > Cognitive Neurology and Alzheimer¹s Disease Center
> > Northwestern Univ., 320 E. Superior St., Searle 11-470, Chicago, IL 60611
> > Voice: (312) 908-9023 Fax: (312) 908-8789
> > -------------------------------------------------------------------------
> >
> >
> >
-------------------------------------------------------------------------
Darren R. Gitelman, M.D.
Cognitive Neurology and Alzheimer¹s Disease Center
Northwestern Univ., 320 E. Superior St., Searle 11-470, Chicago, IL 60611
Voice: (312) 908-9023 Fax: (312) 908-8789
-------------------------------------------------------------------------
|