Dear Marko,
if you have a volume "vol", a mask "mask", a kernel with size "FWHM" and the voxelsize "vx" you
can use the following code to obtain a masked smooth volume "svol":
dim = size(vol);
Q = find(mask > 0);
svol = zeros(dim);
smask = zeros(dim);
tmpvol = zeros(dim);
tmpvol(Q) = ones(size(Q));
spm_smooth(tmpvol,smask,FWHM./vx);
tmpvol(Q) = vol(Q);
spm_smooth(tmpvol,svol,FWHM./vx);
vol(Q) = svol(Q)./smask(Q);
svol = vol;
Best regards,
Christian
--
____________________________________________________________________________
Christian Gaser, Ph.D.
Assistant Professor of Computational Neuroscience
Department of Psychiatry
Friedrich-Schiller-University of Jena
Philosophenweg 3, D-07743 Jena, Germany
Tel: ++49-3641-935805 Fax: ++49-3641-935280
e-mail: [log in to unmask]
http://dbm.neuro.uni-jena.de
On Thu, 21 Dec 2006 12:45:57 +0100, Marko Wilke <[log in to unmask]>
wrote:
>Dear All,
>I have been playing with some smoothing options and wondered if there is
>a way (in spm or Matlab) to exclude certain regions from smoothing.
>
>I know I can mask an image but then the value of zero will still
>influence the neighboring voxels. I tried NaN's (also with a dedicated
>conv2nan function) but the effects are far too widespread. I looked into
>deconvolutions but this is rather far beyond me... so if anyone has any
>good ideas on hw to approach this, I would be really grateful.
>
>Wihing all of you happy holidays (if you celebrate them, otherwise just
>happy days ;),
>best,
>Marko
>--
>===========================================================
==========
>Marko Wilke (Dr.med./M.D.)
> [log in to unmask]
>
>Universitäts-Kinderklinik University Children's Hospital
>Abt. III (Neuropädiatrie) Dept. III (Pediatric neurology)
> Hoppe-Seyler-Str. 1, D - 72076 Tübingen
>Tel.: (+49) 07071 29-83416 Fax: (+49) 07071 29-5473
>===========================================================
==========
>===========================================================
=============
|