Size of a kernel

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 件のコメント

Ryan
Ryan 2012 年 6 月 11 日
What do you mean by kernel? If you're referring to the size of your Gaussian kernel, it is dictated by the "4". You can either enter a number, which specifies a square matrix or as a vector ([rows cols]) that specifies a particularly shaped Gaussian kernel.
Med_Imager
Med_Imager 2012 年 6 月 11 日
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 2012 年 6 月 11 日
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.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2012 年 6 月 17 日

0 投票

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?

質問済み:

2012 年 6 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by