Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions engine/processor/+computeRLS/core.m
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@
% to do : compute fluo, sync trajectories

%% =========================================DIVTIMES=================================================
end
function [divTimes]=computeDivtime(id,proba,classes,param,frames)

frameIdx = localNormalizeRLSFrames(frames, numel(id));
Expand Down Expand Up @@ -737,6 +738,7 @@
% divTimes.duration=diff(divFrames); % division times !
% end

end
function frameIdx=localNormalizeRLSFrames(frames,nFrames)
if nargin<2 || isempty(nFrames) || ~isfinite(nFrames) || nFrames<1
frameIdx=[];
Expand Down Expand Up @@ -824,6 +826,7 @@
info.changedFrames=sum(idOut(:)'~=argmaxId(:)');


end
function idOut=localModeFilterLabels(idIn,window)
idOut=idIn(:)';
window=max(1,round(double(window)));
Expand All @@ -849,6 +852,7 @@
end


end
function idOut=localViterbiDecode(proba,classes,param)
[nStates,nFrames]=size(proba);
if nFrames==0
Expand Down Expand Up @@ -887,6 +891,7 @@
idOut=path;


end
function out=localDecodeClassNames(classes,nStates)
out=cellstr(string(classes(:)'));
if numel(out)>=nStates
Expand All @@ -898,6 +903,7 @@
end


end
function trans=localViterbiTransitionMatrix(classes,param)
n=numel(classes);
unexpected=localNumericParam(param,'ViterbiUnexpectedTransitionPenalty',1.0);
Expand Down Expand Up @@ -947,6 +953,7 @@
end


end
function [divFramesOut,rejectedDivFrames,minInterval]=localApplyDivisionIntervalRule(divFrames,param)
divFramesOut=divFrames;
rejectedDivFrames=[];
Expand Down Expand Up @@ -982,6 +989,7 @@
end


end
function minInterval=localActiveMinDivisionInterval(param)
minInterval=localNumericParam(param,'MinDivisionInterval',NaN);
if isnan(minInterval) || minInterval<=0
Expand All @@ -998,6 +1006,7 @@
end


end
function threshold=localActiveArrestThreshold(param)
expected=localNumericParam(param,'ExpectedDivisionPeriod',NaN);
arrestThreshold=localNumericParam(param,'ArrestThreshold',3);
Expand All @@ -1012,6 +1021,7 @@
threshold=max(1,round(threshold));


end
function out=localChoiceString(param,field,defaultValue)
out=defaultValue;
if ~isfield(param,field) || isempty(param.(field))
Expand All @@ -1026,6 +1036,7 @@
end


end
function out=localNumericParam(param,field,defaultValue)
out=defaultValue;
if ~isfield(param,field) || isempty(param.(field))
Expand All @@ -1045,6 +1056,7 @@
end


end
function param=localEnsureQCDefaults(param)
defaults=struct();
defaults.ArrestThreshold=3;
Expand Down Expand Up @@ -1072,6 +1084,7 @@
end


end
function out=localBoolParam(param,field,defaultValue)
out=defaultValue;
if ~isfield(param,field) || isempty(param.(field))
Expand All @@ -1094,6 +1107,7 @@
end


end
function out=localTextParam(param,field,defaultValue)
out=defaultValue;
if ~isfield(param,field) || isempty(param.(field))
Expand All @@ -1113,6 +1127,7 @@
end


end
function names=localMetricDataSelection(param)
names={};
if ~isfield(param,'metrics_data') || isempty(param.metrics_data)
Expand Down Expand Up @@ -1141,6 +1156,7 @@
names=unique(names,'stable');


end
function [fluo_data,mask_data]=localSelectMetricDataSeries(dataSeries,selection)
fluo_data=[];
mask_data=[];
Expand Down Expand Up @@ -1192,16 +1208,16 @@
if ~isempty(maskIdx)
mask_data=dataSeries(maskIdx);
end


end
function tf=localUseAutoMetrics(selection)
tf=isempty(selection);
if tf
return
end
tokens=lower(strtrim(string(selection(:))));
tf=any(tokens=="<auto>" | tokens=="auto" | tokens=="all" | tokens=="<all>");

end

function tf=localCanQuantifyIntervals(totaltime)
tf=false;
Expand All @@ -1216,7 +1232,7 @@
return
end
tf=true;

end

function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
n=height(t);
Expand Down Expand Up @@ -1256,7 +1272,7 @@ function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
ds.addData(qcScore,{'qc_score'},'plot',false,'groups','qc');
ds.addData(qcIntervalUsable,{'qc_interval_usable'},'plot',false,'groups','qc');


end
function status=localRLSStatus(divTimes)
endType=lower(string(divTimes.endType));
if endType=="neverborn"
Expand All @@ -1275,12 +1291,12 @@ function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
status="stillAlive";
end


end
function tf=localStructuralUsable(status)
bad=["neverBorn","clog","emptied"];
tf=~any(status==bad);


end
function reason=localStatusReason(status,structuralUsable,roiQCOk,divTimes) %#ok<INUSD>
if ~structuralUsable
switch status
Expand All @@ -1305,7 +1321,7 @@ function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
reason="ok";
end


end
function [meanConf,minConf,meanMargin,lowFraction,qcScore,intervalUsable]=localIntervalQC(totaltime,proba,param)
n=numel(totaltime);
meanConf=nan(n,1);
Expand Down Expand Up @@ -1369,7 +1385,7 @@ function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
lowFraction(r)<=param.QCMaxLowConfidenceFraction;
end


end
function tf=localNeedsDataLoad(roiobj)
tf=true;
try
Expand Down Expand Up @@ -1400,5 +1416,4 @@ function localAddRLSQCData(ds,t,divTimes,id,proba,classes,param) %#ok<INUSD>
catch
tf=true;
end


end