Dear David,
The -kernel file option is the right one for you, but this only selects the kernel - you still need to apply the kernel in a convolution operation. From your description I think the -fmeanu option would be right for you (add this after the "-kernel file weight_array" options).
The weight_array file needs to be a NIFTI image file, which in your case should be a 3D image that has 5x5x5 voxels, containing the intensities as you've specified them. The voxel dimensions (in mm) will be ignored when loading a kernel, as it will consider them to have the same voxel dimensions as the input image.
You can fairly easily make the weight_array image with fslcreatehd and fslview (to manually set the voxel intensities) or by using matlab (with save_avw from $FSLDIR/etc/matlab, or any other equivalent nifti image saving routine).
All the best,
Mark
On 16 Sep 2013, at 23:14, David Romano <[log in to unmask]> wrote:
> Hi everyone,
>
> Suppose I have a 3D image in a file called brain.nii.gz, and that I'd like to produce a new .nii.gz file by replacing -- at each voxel -- the weighted average of all the voxels in a 5x5x5 cube centered at that voxel, where the central voxel is given a weight of 3, the remaining voxels of the inner 3x3x3 cube are given weights of 2, and the outer voxels of the 5x5x5 cube are given a weight of 1.
>
> I'm used to thinking of this as the result of 1) convolving the original image with the 5x5x5 array of weights, and then 2) selecting those entries of the resulting array that correspond to the original image array, but I'm not sure how to implement this in fslmaths (if it's even possible). I can see that it's possible to specify "kernels", which I think corresponds to my array of weights, so maybe I could specify the convolution with the command:
>
> fslmaths brain -kernel file weight_array convolved_image
>
> but I'm not sure what kind of file format should be used for 'weight_array' or the dimensions of the output file convolved_image.nii.gz will be, or its voxels' relationships to the those of the original brain.nii.gz image.
>
> I'd be grateful for any advice or pointers to relevant documentation.
>
> Thanks in advance for your help!
>
> David Romano
|