# How to set sigmas and kernels for 3D-Laplacian of Gaussian filters to blob detection in Matlab?

I have written code according to a paper for Lung CT images, but its output wasn't correct. I think it is because of the setting of its parameters. The paper is about a multi-scale method using a Laplacian of Gaussian (LoG) filter for estimation of nodule size and location. For nodule location and size estimation, the algorithm generates nodule candidates in a small region of interest around the nodule, and the best candidate is selected through a rule-based method.

In the paper, the size parameter of the kernel is directly related to the diameter of a candidate nodule as given by this expression d^2 = 12*sigma^2. So, for the task of identifying possible candidates, 150 normalized LoG kernels of incrementally increasing size corresponding to the diameter range from 3.0 to 30.0 mm were used. However, I couldn't set other sigmas based on the diameter of the nodules according to that formula(d^2 = 12*sigma^2). How can I set the parameters in the following code?

Code:

% Algorithm parameters
load image  % image is 3D as image(x: row, y: col, z: slices).
% Initial sigma used to generate the Gaussian Filters
initial_sigma = 1;
% Number of scales that are going to be generated
number_scales = 7;
% Threshold that indicates whether a blob is considered or not
threshold = 1;

sigmas = initial_sigma.*(sqrt(2).^[0: number_scales-1]);
imageSize = size(image);
dimX=imageSize(1);
dimY=imageSize(2);
dimZ=imageSize(3);
% Reserve memory for the space-scale volume
scale_space_volume = ones([size(image) number_scales]);
% Generate the scale-space volume using different gaussians
for i = 1 : number_scales
filter_size = 2 * ceil(sigmas(i) * 2) + 1;

% Create the 3D laplacian of gaussian filter
H = fspecial3('log', [filter_size filter_size filter_size], sigmas(i));

% Apply the filter to the image and store it in the volume
scale_space_volume(:,:,:, i) = sigmas(i)^2 * imfilter(image, H, 'replicate');
% imshow(scale_space_volume(:,:, 85, i));

end

• You might want to normalize with sigmas(i)^3 instead, for a 3D filter. Your filter_size is very small for a LoG, you're probably cutting off a significant portion of the tails. I'd do 2 * ceil(sigmas(i) * 4) + 1, but if you're pressed for time, you could do *3. However, if you're pressed for time you'd be better off using separable filters here, the LoG is not separable but is the sum of separable filters, you can save a lot of computation time there if you need it. – Cris Luengo Jan 15 '19 at 19:36
• @Cris Luengo: Yes, Its time complexity is high and I don't know how to solve 3DLOG time!? I check it with filter_size = 2 * ceil(sigmas(i) ^ 4) + 1; but the output is the same. I think one problem is the sigma's setting according to nodule size for 150 kernels. That means that sigma = sqrt(d^2/12), d=3 up to 30.  : sigma1, sigma2, ....sigma150. – Eli Jan 15 '19 at 20:31