Commit 7420ee0e authored by ac 20's avatar ac 20

added membrane feature

parent 6a44ff9f
......@@ -950,12 +950,12 @@ function drawHulls(tHulls)
}
// color by feature?
if (nFeature>=0) {
var fmax=gFeatureExtrema[nFeature][1];
var fmin=gFeatureExtrema[nFeature][0];
// scale so colors go from [0.2,1]
// puts it on [0,1]
var fval=1 - (tHulls[i][CONSTANTS.cellFeatures[0].name] - fmin)/((fmax-fmin));
// now put it on [0.1,1]
// var fmax=gFeatureExtrema[nFeature][1];
// var fmin=gFeatureExtrema[nFeature][0];
// // scale so colors go from [0.2,1]
// // puts it on [0,1]
var fval=tHulls[i][CONSTANTS.cellFeatures[0].name];
// // now put it on [0.1,1]
fval=0.9*fval+0.1;
color = getHTMLcolor([fval,fval,fval]);
}
......
......@@ -5,7 +5,7 @@ exec(conn,['ALTER TABLE tblCellFeatures ADD COLUMN ' featureName ' NUMBER']);
nf.name=featureName;
nf.color=color;
if ~isfield(CONSTANTS,'cellFeatures')
if ~isfield(CONSTANTS,'cellFeatures') || isempty(CONSTANTS.cellFeatures)
CONSTANTS.cellFeatures=nf;
else
if ~any(cell2mat(strfind({CONSTANTS.cellFeatures.name},nf.name)))
......
function membraneRatio(conn,CONSTANTS,args,t)
params.channel=1;
params.name='membraneRatio';
params.color="#ff0000";
% check for param override
params=Segment.getParams(params,args);
% segmentation params -- for min radius
segParams=Read.getSegmentationParams(conn);
bw=Segment.getMembrane(CONSTANTS,params.channel,t);
if isempty(bw) || any(isnan(bw(:))) || all(bw(:)==0)
return;
end
if is3D(bw)
fprintf(2,'membraneRatio untested in 3d - not computing\n');
return;
end
Cells=Read.getCellsTime(conn,t);
for i=1:length(Cells)
idxSurface=sub2ind(size(bw),Cells(i).surface(:,2),Cells(i).surface(:,1));
idxSurface(isnan(idxSurface))=[];
ratio = length(find(bw(idxSurface)))/length(idxSurface);
cmd=['insert or ignore into tblCellFeatures(cellID) values (' ...
num2str(Cells(i).cellID) ')'];
exec(conn,cmd);
cmd=['update tblCellFeatures set ' params.name '=' num2str(ratio) ...
' where cellID=' num2str(Cells(i).cellID)];
exec(conn,cmd);
end
function ratio=getErkRatio(im,idxOuter,idxInner)
ratio=NaN;
imOuter=im(idxOuter);
imOuter(0==imOuter)=[];
if length(imOuter)<5
return
end
imInner=im(idxInner);
imInner(0==imInner)=[];
if length(imInner)/length(idxInner)<0.1
return
end
ratio=median(imOuter)/median(imInner);
......@@ -2,7 +2,7 @@ function bwMembrane=getMembrane(CONSTANTS,channel,t)
im = MicroscopeData.Reader('imageData',CONSTANTS.imageData, 'chanList',channel,...
'timeRange',[t t], 'outType','single','prompt',false);
if isempty(im) || all(im==0)
if isempty(im) || all(im(:)==0)
bwMembrane=[];
return;
end
......
......@@ -91,6 +91,17 @@
},
"function":"+CellFeatures.netNuclearEnvelope.m",
"commandHost":"matlab"
},
{
"name": "membraneRatio",
"type" : "feature",
"description" : "% of fg membrane pixels along surface",
"params" : {
"name":"membraneRatio",
"channel":1,
"color":"#ff0000"
},
"function":"+CellFeatures.membraneRatio.m",
"commandHost":"matlab"
}
]
\ 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