Commit f299760a authored by Andrew Cohen's avatar Andrew Cohen

use denoised image for LoG

parent 8b7c8e45
......@@ -31,12 +31,12 @@ if is3D(im)
end
if USE_CUDA
logRadius=min_radius_pixels.*(1/sqrt(3));
imLog=HIP.LoG(imRaw,logRadius,[]);
imLog=HIP.LoG(im,logRadius,[]);
else
% use difference of gaussian approximation
logRadius=min_radius_pixels;
imd1=imgaussfilt3(imRaw,sqrt(2).*logRadius);
imd2=imgaussfilt3(imRaw,logRadius./sqrt(2));
imd1=imgaussfilt3(im,sqrt(2).*logRadius);
imd2=imgaussfilt3(im,logRadius./sqrt(2));
imLog=imd1-imd2;
end
else
......@@ -45,16 +45,16 @@ else
logRadius=(1/sqrt(2)).*min_radius_pixels;
logRadius(2)=logRadius(1);
logRadius(3)=0;
imLog=HIP.LoG(imRaw,logRadius,[]);
imLog=HIP.LoG(im,logRadius,[]);
else
if length(min_radius_pixels)>1
logRadius=0.5*min(min_radius_pixels(1:2));
else
logRadius=0.5*min_radius_pixels ;
end
szFilter=round(size(imRaw)/3);
szFilter=round(size(im)/3);
h=fspecial('log',szFilter,logRadius);
imLog=imfilter(imRaw,h,'replicate');
imLog=imfilter(im,h,'replicate');
end
end
......@@ -93,6 +93,9 @@ if is3D(im)
end
else
imx = medfilt3(im);
for i=1:30
imx=medfilt3(imx);
end
end
else
% 2D
......
......@@ -12,10 +12,10 @@ else
end
if sensitivity>1 && round(sensitivity)==sensitivity
lm=multithresh(imLog,sensitivity)
lm=multithresh(imLog,sensitivity);
bwLog=logical(imLog>lm(end));
bwLog=bwareaopen(bwLog,4*min_area_pixels);
lm=multithresh(im,sensitivity)
lm=multithresh(im,sensitivity);
bw=logical(im>lm(end));
bw=bwareaopen(bw,min_area_pixels);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment