Commit c235393c authored by actb's avatar actb

3d support in fsintensity

parent 1eb6bc3b
......@@ -82,12 +82,18 @@ if ~segParams.isPhase
bw=bw|imfill(bw,'holes');
end
[L,num]=bwlabeln(bw);
if ~is3D(im)
assignRadius=2*min_radius_pixels(1);
else
assignRadius=min(min_radius_pixels).*2;
end
[d,dNN]=bwdist(bw);
[L,num]=bwlabel(bw);
bwAssign=bw2&~bw;
bwAssign(d>2*min_radius_pixels)=0;
bwAssign(d>assignRadius)=0;
idxAssign=find(bwAssign);
L(idxAssign)=L(dNN(idxAssign));
num=max(L(:));
% tic
......
......@@ -58,6 +58,7 @@ else
end
end
imLog=mat2gray(imLog);
4;
function im=denoise(im,segParams)
......
......@@ -7,16 +7,20 @@ bwDilate=bwLog;
qL=origL;
% nDimension is 2 for 2-D, 3 for 3-D used for concat'ing
nDimension=length(size(bw));
minKernelArea=10; %floor(min_area_pixels/4)+1;
if is3D(bw)
minKernelArea=27;
else
minKernelArea=9; %floor(min_area_pixels/4)+1;
end
if is3D(bw)
se=strel('cube',3);
else
se=strel('square',3);
se=strel('disk',1);
end
for nDilate=1:2*min_radius_pixels
kernels=bwfill(bwDilate,'holes')&~bwDilate;
kernels=imfill(bwDilate,'holes')&~bwDilate;
kernels=kernels&bw;
kernels=bwareaopen(kernels,minKernelArea);
if isempty(find(kernels, 1))
......
......@@ -2,10 +2,22 @@
function [bw,bwLog]=thresholdImagess(im,imLog,segParams, min_radius_pixels,min_area_pixels,...
medianMask)
if is3D(im)
% use 2x the default nhood size
T=adaptthresh(imLog,0.5,'statistic','gaussian');
bwLog=imbinarize(imLog,T);
bwLog=bwareaopen(bwLog,min_area_pixels);
nsz=4*floor(size(im)/16)+1;
nsz(3)=nsz(1);
T=adaptthresh(im,0.4,'NeighborhoodSize',nsz,'statistic','gaussian');
bw=imbinarize(im,T);
return;
end
T=adaptthresh(imLog,0.5,'NeighborhoodSize',4*floor(size(im)/16)+1,'statistic','gaussian');
bwLog=imbinarize(imLog,T);
bwLog=bwareaopen(bwLog,4*min_area_pixels);
if segParams.isPhase
se=strel('disk',1);
se2=strel('disk',ceil(min_radius_pixels/2));
......
......@@ -2,4 +2,6 @@ function [conn,CONSTANTS,segParams]=openDB(strDB)
conn = database(strDB, '','', 'org.sqlite.JDBC', 'jdbc:sqlite:');
CONSTANTS=Read.getConstants(conn);
segParams=Read.getSegmentationParams(conn);
\ No newline at end of file
segParams=Read.getSegmentationParams(conn);
segParams.draw=true;
segParams.nCores=feature('numcores');
\ No newline at end of file
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