Commit 1d8217ca authored by actb's avatar actb

rename of FrameSegment_texture to frameSegment

parent 7444694c
......@@ -3,7 +3,7 @@ const fs = require('fs');
// use sha1 so it will match our git commit tags
const hash = crypto.createHash('sha1');
//const input = fs.createReadStream('..\\matlab\\+Segment\\FrameSegment.m');
//const input = fs.createReadStream('..\\matlab\\+Segment\\frameSegment.m');
if (3!=process.argv.length) {
console.error('USAGE: node goHash.js filename');
......
......@@ -48,7 +48,7 @@ for idp=0:ceil(size(commandList,1)/p.NumWorkers)-1
sp.NLM(4)=commandList{labindex+idxCommandList,'hpf'};
sp.alpha=commandList{labindex+idxCommandList,'alpha'};
sp.ensemble_minimumRadius_um=true;
nc=Segment.FrameSegment_texture('',1,CONSTANTS,sp);
nc=Segment.frameSegment('',1,CONSTANTS,sp);
else
nc=[];
end
......
......@@ -77,7 +77,7 @@ for idp=0:ceil(size(commandList,1)/p.NumWorkers)-1
sp=segParams;
sp.minimumRadius_um=commandList(labindex+idxCommandList,2);
if isempty(intersect(t,tSeg)) && t>0 && t<=CONSTANTS.imageData.NumberOfFrames
nc=Segment.FrameSegment_texture('',t,CONSTANTS,sp,medianMask);
nc=Segment.frameSegment('',t,CONSTANTS,sp,medianMask);
else
if ~isempty(intersect(t,tSeg))
fprintf(1,' found existing seg, t=%d, idxCommandList=%d\n',t,idxCommandList+labindex);
......
......@@ -37,7 +37,7 @@ parfor i=1:length(rgRadius)
% note as of matlab2019b, we pass [] for the conn (1st) argument as the
% param is unused as long as CONSTANTS are provided, and even passing
% it around in a parfor generates a warning
cx=Segment.FrameSegment_texture([],t,CONSTANTS,args,medianMask);
cx=Segment.frameSegment([],t,CONSTANTS,args,medianMask);
ensembleCells{i}=cx;
end
segParams.draw=ensembleDraw;
......
% called by Segmente.FrameSegment_texture to set the
% called by Segmente.frameSegment to set the
% area, convexArea, circularity on each cell
function newCell=setCellFeatures(newCell,RP,n,segParams)
......
......@@ -55,7 +55,7 @@ for t=1:CONSTANTS.imageData.NumberOfFrames
if length(idx)<5
continue
end
newCell=Segment.FrameSegment_3D_create(idx,size(bwMeta),metaChannel,t);
newCell=Segment.frameSegment_create_3D(idx,size(bwMeta),metaChannel,t);
metaCells=[metaCells newCell];
end
end
......
......@@ -84,7 +84,7 @@ end
segParams=Read.getSegmentationParams(conn);
ptsReplicate_xy=Segment.FrameSegment_texture_getSplitPixels(conn,CONSTANTS,...
ptsReplicate_xy=Segment.frameSegment_getSplitPixels(conn,CONSTANTS,...
idxPixels, channel, time, segParams);
try
......@@ -106,7 +106,7 @@ for kpts=1:max(idx)
return;
end
ptsIdx=find(idx==kpts);
newCell=Segment.FrameSegment_texture_create(idxPixels(ptsIdx),size(bw),...
newCell=Segment.frameSegment_create(idxPixels(ptsIdx),size(bw),...
channel,time,conn,segParams);
newCell.segCC=Q{6};
Cells=[Cells newCell];
......
function newCell=FrameSegment_texture_create(idxPixels, imSize, channel, time, ...
function newCell=frameSegment_create(idxPixels, imSize, channel, time, ...
conn, params)
if 3==length(imSize) && imSize(3)>1
% 3D
newCell=Segment.FrameSegment_3D_create(idxPixels, imSize, channel, time);
newCell=Segment.frameSegment_create_3D(idxPixels, imSize, channel, time);
return;
end
......
function newCell=FrameSegment_3D_create(idxPixels, imSize, channel, time, ...
conn, params)
bwn=zeros(imSize);
bwn(idxPixels)=1;
PAD=5;
% padd with extra zeros around the outside so our mesh covers boundaries
bpad = zeros(size(bwn)+10);
bpad(PAD+1:end-PAD,PAD+1:end-PAD,PAD+1:end-PAD)=bwn;
bwn = bpad;
% scale=[1,1,1];
scale=max(imSize)./imSize/8;
scale=max(min(scale,0.5),.01);
%
resize=round(scale.*size(bwn));
bwResize=imresize3(bwn,resize);
[faces,verts]=isosurface(bwResize,graythresh(bwResize));
if size(verts,1)<10
resize=round(2*scale.*size(bwn));
bwResize=imresize3(bwn,resize);
[faces,verts]=isosurface(bwResize,graythresh(bwResize));
end
norms = isonormals(bwResize,verts);
% rescale verts back to
unscale=(size(bwn)./size(bwResize));
% put unscale on x,y instead of r,c
unscale=[unscale(2),unscale(1),unscale(3)];
verts=(verts).*unscale-0.5*unscale;
edges=Segment.MakeEdges(faces);
% make edges and faces zero indexed
edges=edges-1;
faces=faces-1;
% subtract extract for padding
verts=verts-PAD;
maxRad = verts-repmat(mean(verts,1),size(verts,1),1);
maxRad=sum(abs(maxRad),2);
maxRad=max(maxRad);
newCell=[];
newCell.time=time;
newCell.centroid=[mean(verts,1)]-1;
newCell.edges=edges;
newCell.faces=faces;
newCell.verts=verts;
newCell.normals=norms;
xyzPts=[];
% note that xyzPts are on the correct range, as idxPixels is unpadded...
[xyzPts(:,2),xyzPts(:,1),xyzPts(:,3)]=ind2sub(imSize,idxPixels);
newCell.pts=uint16(xyzPts);
newCell.maxRadius=maxRad;
newCell.channel=channel;
function newCell=FrameSegment_create_3D(idxPixels, imSize, channel, time, ...
conn, params)
bwn=zeros(imSize);
bwn(idxPixels)=1;
PAD=5;
% padd with extra zeros around the outside so our mesh covers boundaries
bpad = zeros(size(bwn)+10);
bpad(PAD+1:end-PAD,PAD+1:end-PAD,PAD+1:end-PAD)=bwn;
bwn = bpad;
% scale=[1,1,1];
scale=max(imSize)./imSize/8;
scale=max(min(scale,0.5),.01);
%
resize=round(scale.*size(bwn));
bwResize=imresize3(bwn,resize);
[faces,verts]=isosurface(bwResize,graythresh(bwResize));
if size(verts,1)<10
resize=round(2*scale.*size(bwn));
bwResize=imresize3(bwn,resize);
[faces,verts]=isosurface(bwResize,graythresh(bwResize));
end
norms = isonormals(bwResize,verts);
% rescale verts back to
unscale=(size(bwn)./size(bwResize));
% put unscale on x,y instead of r,c
unscale=[unscale(2),unscale(1),unscale(3)];
verts=(verts).*unscale-0.5*unscale;
edges=Segment.MakeEdges(faces);
% make edges and faces zero indexed
edges=edges-1;
faces=faces-1;
% subtract extract for padding
verts=verts-PAD;
maxRad = verts-repmat(mean(verts,1),size(verts,1),1);
maxRad=sum(abs(maxRad),2);
maxRad=max(maxRad);
newCell=[];
newCell.time=time;
newCell.centroid=[mean(verts,1)]-1;
newCell.edges=edges;
newCell.faces=faces;
newCell.verts=verts;
newCell.normals=norms;
xyzPts=[];
% note that xyzPts are on the correct range, as idxPixels is unpadded...
[xyzPts(:,2),xyzPts(:,1),xyzPts(:,3)]=ind2sub(imSize,idxPixels);
newCell.pts=uint16(xyzPts);
newCell.maxRadius=maxRad;
newCell.channel=channel;
function ptsReplicate_xy=FrameSegment_texture_getSplitPixels(conn,CONSTANTS,idxPixels, channel, time, ...
function ptsReplicate_xy=frameSegment_getSplitPixels(conn,CONSTANTS,idxPixels, channel, time, ...
params)
segParams=Segment.getDefaultSegParams();
......
......@@ -3,7 +3,7 @@ function [functionHandle,params]=getSegmentHelper(conn,strAlgorithmType)
% set the default seg function and args
% default
if strcmp('segment',strAlgorithmType)
functionHandle=str2func('Segment.FrameSegment');
functionHandle=str2func('Segment.frameSegment');
else
functionHandle=[];
end
......
......@@ -5,7 +5,7 @@ jsAlgorithmInfo=[];
jsAlgorithmInfo.name='2D+3D generic: texture+gradient partition';
jsAlgorithmInfo.type='segment';
jsAlgorithmInfo.params=segParams;
jsAlgorithmInfo.function='+Segment.FrameSegment_texture';
jsAlgorithmInfo.function='+Segment.frameSegment';
jsAlgorithmInfo.commandHost='matlab';
jsAlgorithmInfo=jsonencode(jsAlgorithmInfo);
tag=datestr(datetime());
......
......@@ -24,7 +24,7 @@
"note_4":"bCircular adds a bit more weight to circular segmentations (ensemble only)",
"bCircular":"false"
},
"function":"+Segment.FrameSegment_texture.m",
"function":"+Segment.frameSegment.m",
"commandHost":"matlab"
},
{
......
This source diff could not be displayed because it is stored in LFS. You can view the blob instead.
No preview for this file type
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