Dear Tim,
I assume that you have:
* a NIfTI/Analyze home-made statistic image, spm.{hdr,img},
* a NIfTI/Analyze mask image, mask.{hdr,img} with 0/1 labels, with same
dimensions and orientations than the previous file,
* a height threshold u,
* a cluster extent threshold k.
Then to create a new image, tspm.{hdr,img}, thresholded with u and k and
using mask, you can do something along those lines:
u = 4; k = 10;
vt = spm_vol('spm.img');
vm = spm_vol('mask.img');
t = spm_read_vols(vt);
m = spm_read_vols(vm);
t(m==0 | t < u) = NaN;
[l, n] = spm_bwlabel(double(~isnan(t)),26);
j = histc(l(:),[0:max(l(:))]+0.5);
j = j(1:end-1)';
for i=find(j<k), l(l==i) = 0; end
t(~l) = NaN;
vt.fname = 'tspm.img';
spm_write_vol(vt,t);
spm_check_registration(char({'spm.img','mask.img','tspm.img'}));
I hope this helps,
Guillaume
Tim Hahn wrote:
> Dear SPMers,
>
> I have a seemingly very simple problem which turned out to be not so simple: I
> a single image (with a home-made statistic). All I want to do is display those
> voxels within this image, which exceed a certain value (e.g. >4), lie within a
> certain ROI (of which I have an analyze img with all 0s and 1s), and are
> located within a voxel cluster with more than e.g. 10 voxels.
> This should be very simple using MRICro or MRICron, but I'm having trouble
> creating *.roi-format masks in MRICro (it doesn't have a header and
> everythings ends up in the wrong place) and applying a cluster size threshold
> in MRICron. To do it in SPM, one needs an SPM.mat etc. so that doesn't make
> sense.
>
> Can I import my single map directly into SPM's results section and use the
> masking and cluster extent threshholding implemented there?
> All I really need is a display tool which can handle masks and which can apply
> a hight and a cluster extent threshhold.
>
> Thanks in advance.
> Best,
> Tim
>
>
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|