Package sc.fiji.snt.analysis.curation
Class PlausibilityCalibrator
java.lang.Object
sc.fiji.snt.analysis.curation.PlausibilityCalibrator
Infers
PlausibilityCheck thresholds from a collection of reference
Trees. For each configurable parameter the calibrator collects the
corresponding metric across every parent-child fork (live checks) or every
path (deep checks) and derives thresholds from percentile statistics.
Typical usage:
PlausibilityCalibrator cal = new PlausibilityCalibrator(trees);
CalibrationResult result = cal.calibrate();
result.applyTo(monitor); // updates all thresholds
System.out.println(result.toTable()); // human-readable summary
- Author:
- Tiago Ferreira
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAggregated calibration results from a set of reference trees.static final recordSummary for a single calibrated parameter. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlausibilityCalibrator(Collection<Tree> trees) Creates a calibrator from a collection of reference trees. -
Method Summary
Modifier and TypeMethodDescriptionRuns the calibration against all reference trees and returns aPlausibilityCalibrator.CalibrationResultcontaining the inferred thresholds.static FilegetCurationsDirectory(File workspaceDir) Returns the curations subdirectory inside the given workspace directory.static File[]listCurationFiles(File workspaceDir) Lists all.curationfiles in the curations subdirectory of the given workspace directory.static voidload(File file, PlausibilityMonitor monitor) Loads thresholds and enabled states from a.curationproperties file and applies them to the given monitor.static voidloadBuiltIn(String presetName, PlausibilityMonitor monitor) Loads a built-in curation preset bundled in the SNT JAR and applies it to the given monitor.static voidsave(PlausibilityMonitor monitor, File file, String comment) Saves the current state of aPlausibilityMonitor(thresholds and enabled states) to a.curationproperties file.voidsetLowerPercentile(double percentile) Sets the percentile used for "flag if below" thresholds (e.g., min fork angle, min terminal branch length).voidsetUpperPercentile(double percentile) Sets the percentile used for "flag if above" thresholds (e.g., max fork angle, max radius ratio).
-
Field Details
-
CURATION_EXTENSION
The file extension for curation preset files (without leading dot).- See Also:
-
BUILT_IN_PRESETS
Names of built-in curation presets bundled with SNT (without the.curationextension). This list must be kept in sync with the files undersrc/main/resources/curations/.
-
-
Constructor Details
-
PlausibilityCalibrator
Creates a calibrator from a collection of reference trees.- Parameters:
trees- the reference trees (must not be null or empty)- Throws:
IllegalArgumentException- iftreesis null or empty
-
-
Method Details
-
setUpperPercentile
public void setUpperPercentile(double percentile) Sets the percentile used for "flag if above" thresholds (e.g., max fork angle, max radius ratio). Default is 95.- Parameters:
percentile- the upper percentile (0-100)
-
setLowerPercentile
public void setLowerPercentile(double percentile) Sets the percentile used for "flag if below" thresholds (e.g., min fork angle, min terminal branch length). Default is 5.- Parameters:
percentile- the lower percentile (0-100)
-
calibrate
Runs the calibration against all reference trees and returns aPlausibilityCalibrator.CalibrationResultcontaining the inferred thresholds.- Returns:
- the calibration result (never null)
-
getCurationsDirectory
Returns the curations subdirectory inside the given workspace directory. Creates the directory if it does not exist.- Parameters:
workspaceDir- the SNT workspace directory (e.g., fromSNTPrefs.getWorkspaceDir())- Returns:
- the curations directory (
<workspaceDir>/curations/)
-
listCurationFiles
Lists all.curationfiles in the curations subdirectory of the given workspace directory.- Parameters:
workspaceDir- the SNT workspace directory- Returns:
- an array of curation files (may be empty, never null)
-
save
Saves the current state of aPlausibilityMonitor(thresholds and enabled states) to a.curationproperties file.- Parameters:
monitor- the monitor whose state will be savedfile- the target file (should have.curationextension)comment- an optional header comment (e.g., cell type description)- Throws:
IOException- if writing fails
-
load
Loads thresholds and enabled states from a.curationproperties file and applies them to the given monitor.- Parameters:
file- the curation file to loadmonitor- the monitor to update- Throws:
IOException- if reading fails
-
loadBuiltIn
Loads a built-in curation preset bundled in the SNT JAR and applies it to the given monitor. Preset names correspond to entries inBUILT_IN_PRESETS.- Parameters:
presetName- the preset name (without extension), e.g."dummy1"monitor- the monitor to update- Throws:
IOException- if reading failsIllegalArgumentException- if the preset resource is not found
-