A quick thought:
V=spm_vol(spm_select); % select your image
Data=spm_read_vols(V);
[d,i]=sort(Data(:));
m=seros(size(d));
m(end-round(length(d))*0.05:end)=1;
m2=zeros(size(d));
m2(i)=m;
MaskData=zeros(size(Data));
MaskData(:)=m2;
V.fname='mymask.nii'
spm_write_vol(V,MaskData);
The image mymask.nii will appear in the same folder as the image you
selected. Maybe it could be done a bit more efficient memory wise, but
on an example image it looks like it does the job.
--------------------------------------------------
Dr. S.F.W. Neggers
Division of Brain Research
Rudolf Magnus Institute for Neuroscience
Utrecht University Medical Center
Visiting : Heidelberglaan 100, 3584 CX Utrecht
Room B.01.1.03
Mail : Huispost B.01.206, P.O. Box 85500
3508 GA Utrecht, the Netherlands
Tel : +31 (0)88 7559609
Fax : +31 (0)88 7555443
E-mail : [log in to unmask]
Web : http://www.fmri.nl/people/bas.html
--------------------------------------------------
-----Oorspronkelijk bericht-----
Van: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]]
Namens Jeff Browndyke
Verzonden: donderdag 4 september 2008 19:47
Aan: [log in to unmask]
Onderwerp: [SPM] Upper tail thresholding for mask creation
Hello all,
I have a small series of images that have been log transformed and are
fairly evenly distributed (at least upon appearance in the histogram
function of MRIcron). Unfortunately the MRIcron histogram figure does
not provide hard numbers or the ability to off-load the full range of
intensity values for cut-point determination. In my case, this would be
the top 5% of intensity values. Unfortunately the intensity ranges for
the images vary from subject to subject, though their shapes are fairly
uniform, so I can just "guesstimate" the lower limit of the upper range
from the MRIcron histogram and apply that cut-point to all other
subjects.
Is there a way to establish a mask for each subject, such that each mask
captures only those voxels in the upper tail of the intensity
distribution for each subject? I'm not planning on comparing the
subjects in a statistical model, but would like to have a common metric
(upper 5%) for visualizing the most significantly high voxel intensities
for each subject.
Cheers and thanks,
Jeff
-------------------------------------
Jeff Browndyke
Duke University Medical Center
Dept. of Psychiatry
--------------------------------------
|