Class AStarRefiner
Path: treats the path's current
nodes as waypoints and re-derives the geometry between them via SNT.autoTraceSync(List, sc.fiji.snt.util.PointInImage, SNT.SearchSettingsSnapshot), using either the cost
function/search parameters currently configured on the active SNT instance, or a frozen
SNT.SearchSettingsSnapshot shared across a whole batch (see AStarRefiner(SNT, Path, SNT.SearchSettingsSnapshot)).
Intended for manually-traced paths against data streamed from disk/network, where running A*
interactively may be too slow to be practical. See PathManagerUI's "Refine"
menu ("Re-trace with A*...").
call() is thread-safe for parallel execution across paths (it does not modify the
original path, and calls SNT.autoTraceSync(java.util.List<sc.fiji.snt.util.SNTPoint>, sc.fiji.snt.util.PointInImage) rather than the interactive tracing entry
points, so concurrent workers do not serialize behind the single-threaded pool used by
interactive tracing). apply() must be called sequentially afterward to commit the
result via Path.replaceNodes(Path), which also reconciles this path's own branch point
(if it has a parent) and any of its children's branch points against the new geometry.
- Author:
- Tiago Ferreira
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAStarRefiner(SNT snt, Path path) Creates a refiner for a single path, reading search settings (cost function, data structure, secondary/hessian image) live fromsntat the timecall()actually runs.AStarRefiner(SNT snt, Path path, SNT.SearchSettingsSnapshot settings) Creates a refiner for a single path, using a frozenSNT.SearchSettingsSnapshotinstead of the live search settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply()Applies the re-traced geometry to the original path viaPath.replaceNodes(Path).voidNo-op: kept for consistency with the otherAbstractRefineHelperworkers; there are no per-worker settings to propagate here (seereadPreferences()).call()Runs the A* re-trace on this path's current waypoints.Human-readable reasoncall()failed, or null if it succeeded (or hasn't run yet).getPath()Returns the original path being re-traced.voidNo-op: kept for consistency withPathFitter/MultiSpectralRefiner, which read persisted preferences here.booleanWhether the re-trace succeeded.
-
Constructor Details
-
AStarRefiner
Creates a refiner for a single path, reading search settings (cost function, data structure, secondary/hessian image) live fromsntat the timecall()actually runs.Prefer
AStarRefiner(SNT, Path, SNT.SearchSettingsSnapshot)for batches of more than one path, so all paths share identical settings even if the live A* controls are changed mid-batch (they remain enabled during a batch by design).- Parameters:
snt- the live SNT instance whose current A* search parameters (cost function, hessian, image data) are usedpath- the path to re-trace; must have at least 2 nodes- Throws:
IllegalArgumentException- if path is null or has fewer than 2 nodes
-
AStarRefiner
Creates a refiner for a single path, using a frozenSNT.SearchSettingsSnapshotinstead of the live search settings.- Parameters:
snt- the live SNT instance whose image data is usedpath- the path to re-trace; must have at least 2 nodessettings- a snapshot fromSNT.snapshotSearchSettings(), or null to read the live settings at call-time (equivalent toAStarRefiner(SNT, Path))- Throws:
IllegalArgumentException- if path is null or has fewer than 2 nodes
-
-
Method Details
-
readPreferences
public void readPreferences()No-op: kept for consistency withPathFitter/MultiSpectralRefiner, which read persisted preferences here. A* re-tracing simply reuses whichever search parameters are already configured on the liveSNTinstance. -
applySettings
No-op: kept for consistency with the otherAbstractRefineHelperworkers; there are no per-worker settings to propagate here (seereadPreferences()).- Parameters:
ref- the reference refiner (unused)
-
getPath
Returns the original path being re-traced.- Returns:
- the path
-
succeeded
public boolean succeeded()Whether the re-trace succeeded. Only meaningful aftercall().- Returns:
- true if a valid re-traced path was produced
-
getFailureReason
Human-readable reasoncall()failed, or null if it succeeded (or hasn't run yet).- Returns:
- the failure reason, or null
-
call
Runs the A* re-trace on this path's current waypoints. Thread-safe: does not modify the original path. Callapply()afterward (sequentially) to commit results. -
apply
public void apply()Applies the re-traced geometry to the original path viaPath.replaceNodes(Path). Must be called sequentially (not thread-safe), typically on the EDT after all parallelcall()invocations have completed.- Throws:
IllegalStateException- ifcall()has not been run or did not succeed
-