Size of a kernel

15 views (last 30 days)
Med_Imager
Med_Imager on 11 Jun 2012
Hi I have MR data acquired at 3.8x3.8x8.0 mm resolution. First I load it in to Matlab and then do some Gaussian filtering.
H = fspecial('gaussian',4,1);
for i=1:48
for j=1:8
My_Matrix1= squeeze(Diffb0(:,:,:,i));
My_Matrix1=squeeze(My_Matrix1(:,:,j));
Des_Matrix1=zeros(size(My_Matrix1));
Des_Matrix1 = imfilter(Diff(:,:,j,i),H,'replicate');
New_Diff_1(:,:,j,i)=Des_Matrix1;
end
end
How do I calculate the size of a kernel? Thanks
  3 Comments
Med_Imager
Med_Imager on 11 Jun 2012
Yes, but '4 ' is not the FWHM, or the kernel width. I basically want to know the FWHM in mm.
If I use the 'spm_smooth' function (gaussian filtering in 3D) , I can find the value of the FWHM by putting a' keyboard' in to the code.
s1 = s/sqrt(8*log(2)); FWHM in the SPM code
But with the fspecial.m source code I cannot find out this value.
I need to know the size of a kernel that is used with imfilter.
Ryan
Ryan on 11 Jun 2012
You know the base size and sigma value (4x4 and 1) of the kernel so to calculate FWHM you would just need to locate an equation (which I am unsure of, a quick google search yielded no conclusive results). For a square kernel, the 2D FWHM would be the same as the 1D FWHM because they are symmetric I would imagine.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 17 Jun 2012
What do i and j represent (hopefully not row and column)? Why is My_Matrix1 being overwritten in the loop (i.e. why did you create the first one simply to overwrite it with something different)? Same question for Des_Matrix1. What are Diffb0 and Diff? Why are they 4D matrices?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!