Hi,
You want to do:
fslmaths inputimage -mul 0 -add 1 -roi x 1 y 1 z 1 0 1 -kernel sphere r -fmean -thr 1e-6 -bin outputimage
where x,y,z,r need to be replaced with numerical values that you choose (voxel coords and mm radius respectively) and inputimage and outputimage are filenames.
The first part makes an image containing all ones, the -roi then zeros everything except for the centre voxel, the -kernel and -fmean convolve this with a spherical kernel and the -thr and -bin turn it into a binary image. Note that the threshold needs to be so low just in case the sphere is large, since the spherical kernel is normalised (sums to one) and so the values in each voxel can be very small for large spheres. It is necessary to have the threshold though, as large kernels are convolved using an FFT which results in very small errors (typically around 1e-10 or less) but cause problems if just using -bin without a -thr beforehand.
All the best,
Mark
On 11 Feb 2011, at 23:51, Saeideh Bakhshi wrote:
> Hello,
>
> I need to create a mask using the coordinates of the central voxel (x, y, z) and a known radius a. I tried to use fslmaths with options -kernel sphere, but seems like I don't do it right.
>
> Can someone please show me what is the right syntax to use?
> Thanks,
>
> Saeideh Bakhshi,
> PhD student,
> Georgia Tech College of Computing,
> Atlanta, Ga
> http://www.cc.gatech.edu/~sbakhshi/ <http://www.cc.gatech.edu/%7Esbakhshi/>
>
|