Skip to content
Snippets Groups Projects
Commit f299760a authored by Andrew Cohen's avatar Andrew Cohen
Browse files

use denoised image for LoG

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