1 function J=ImageDerivatives3D(I,sigma,type)
\r
2 % Gaussian based image derivatives
\r
4 % J=ImageDerivatives3D(I,sigma,type)
\r
8 % sigma : Gaussian Sigma
\r
9 % type : 'x', 'y', 'z', 'xx', 'yy', 'zz', 'xy', 'xz', 'yz'
\r
12 % J : The image derivative
\r
14 % Function is written by D.Kroon University of Twente (July 2010)
\r
16 % Make derivatives kernels
\r
17 [x,y,z]=ndgrid(floor(-3*sigma):ceil(3*sigma),floor(-3*sigma):ceil(3*sigma),floor(-3*sigma):ceil(3*sigma));
\r
21 DGauss=-(x./((2*pi)^(3/2)*sigma^5)).*exp(-(x.^2+y.^2+z.^2)/(2*sigma^2));
\r
23 DGauss=-(y./((2*pi)^(3/2)*sigma^5)).*exp(-(x.^2+y.^2+z.^2)/(2*sigma^2));
\r
25 DGauss=-(z./((2*pi)^(3/2)*sigma^5)).*exp(-(x.^2+y.^2+z.^2)/(2*sigma^2));
\r
27 DGauss = 1/((2*pi)^(3/2)*sigma^5) * (x.^2/sigma^2 - 1) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
29 DGauss = 1/((2*pi)^(3/2)*sigma^5) * (y.^2/sigma^2 - 1) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
31 DGauss = 1/((2*pi)^(3/2)*sigma^5) * (z.^2/sigma^2 - 1) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
33 DGauss = 1/((2*pi)^(3/2)*sigma^7) * (x .* y) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
35 DGauss = 1/((2*pi)^(3/2)*sigma^7) * (x .* z) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
37 DGauss = 1/((2*pi)^(3/2)*sigma^7) * (y .* z) .* exp(-(x.^2 + y.^2 + z.^2)/(2*sigma^2));
\r
40 K=SeparateKernel(DGauss);
\r
41 J = imfilter(I,K{1},'conv','symmetric');
\r
42 J = imfilter(J,K{2},'conv','symmetric');
\r
43 J = imfilter(J,K{3},'conv','symmetric');