Skip to content

Commit 68ce4e6

Browse files
committed
Allow computations on cached data when main image closed
1 parent 865e7d9 commit 68ce4e6

6 files changed

Lines changed: 14 additions & 20 deletions

File tree

‎src/main/java/sc/fiji/snt/InteractiveTracerCanvas.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ private void connectToEditingPath(final Path source, final Path destination) {
340340
final Tree newTree = destinationGraph.getTreeWithSamePathStructure();
341341
// enableEditMode(false);
342342
tracerPlugin.setEditingPath(null);
343-
final Calibration cal = tracerPlugin.getImagePlus().getCalibration(); // snt the instance of the plugin
343+
final Calibration cal = tracerPlugin.getCalibration(); // snt the instance of the plugin
344344
newTree.list().forEach(p -> p.setSpacing(cal));
345345
final boolean existingEnableUiUpdates = pathAndFillManager.enableUIupdates;
346346
pathAndFillManager.enableUIupdates = false;
@@ -1374,7 +1374,7 @@ protected void assignTreeRootToEditingNode(final boolean warnOnFailure) {
13741374
editingGraph.setRoot(newRoot);
13751375
final Tree newTree = editingGraph.getTreeWithSamePathStructure();
13761376
tracerPlugin.setEditingPath(null);
1377-
final Calibration cal = tracerPlugin.getImagePlus().getCalibration();
1377+
final Calibration cal = tracerPlugin.getCalibration();
13781378
pathAndFillManager.deletePaths(editingTree.list());
13791379
newTree.list().forEach(p -> {
13801380
p.setSpacing(cal);
@@ -1413,7 +1413,7 @@ protected void splitTreeAtEditingNode(final boolean warnOnFailure) {
14131413
final Tree descendentTree = descendantGraph.getTreeWithSamePathStructure();
14141414
// enableEditMode(false);
14151415
tracerPlugin.setEditingPath(null);
1416-
final Calibration cal = tracerPlugin.getImagePlus().getCalibration(); // snt the instance of the plugin
1416+
final Calibration cal = tracerPlugin.getCalibration(); // snt the instance of the plugin
14171417
ancestorTree.list().forEach(p -> p.setSpacing(cal));
14181418
descendentTree.list().forEach(p -> p.setSpacing(cal));
14191419
final boolean existingEnableUiUpdates = pathAndFillManager.enableUIupdates;

‎src/main/java/sc/fiji/snt/PathAndFillManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ protected void reloadFills(int[] selectedIndices) {
13361336
for (int ind : selectedIndices) {
13371337
Fill fill = allFills.get(ind);
13381338
FillerThread filler = FillerThread.fromFill(
1339-
scope, plugin.getImagePlus().getCalibration(),
1339+
scope, plugin.getCalibration(),
13401340
plugin.getStats(), fill);
13411341
loadedFills.put(fill, filler);
13421342
plugin.addFillerThread(filler);

‎src/main/java/sc/fiji/snt/SNT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3889,7 +3889,7 @@ private static int getView(final String view) {
38893889
};
38903890
}
38913891

3892-
private Calibration getCalibration() {
3892+
public Calibration getCalibration() {
38933893
final Calibration calibration = new Calibration();
38943894
calibration.pixelWidth = x_spacing;
38953895
calibration.pixelHeight = y_spacing;

‎src/main/java/sc/fiji/snt/SNTUI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ private boolean imgDimensionsChanged() {
13921392
|| plugin.getDepth() != imp.getNSlices() || plugin.getChannel() > imp.getNChannels()
13931393
|| plugin.getFrame() > imp.getNFrames())
13941394
return true;
1395-
final Calibration cal = plugin.getImagePlus().getCalibration();
1395+
final Calibration cal = imp.getCalibration();
13961396
return (plugin.getPixelWidth() != cal.pixelWidth || plugin.getPixelHeight() != cal.pixelHeight
13971397
|| plugin.getPixelDepth() != cal.pixelDepth);
13981398
}

‎src/main/java/sc/fiji/snt/gui/cmds/ComputeSecondaryImg.java‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,20 +398,14 @@ private void runCommand() {
398398
"Single-scale Filter Chosen");
399399
}
400400
final RandomAccessibleInterval<T> in = getInputData();
401-
final Calibration cal = sntService.getInstance().getImagePlus().getCalibration();
401+
final Calibration cal = sntService.getInstance().getCalibration();
402402
final double[] spacing = new double[]{cal.pixelWidth, cal.pixelHeight, cal.pixelDepth};
403-
final U type;
404-
switch (outputType) {
405-
case FLOAT:
406-
type = (U) new FloatType();
407-
break;
408-
case DOUBLE:
409-
type = (U) new DoubleType();
410-
break;
411-
default:
412-
throw new IllegalArgumentException("Unknown output type");
413-
}
414-
final int cellDim = 32; // side length for cell
403+
final U type = switch (outputType) {
404+
case FLOAT -> (U) new FloatType();
405+
case DOUBLE -> (U) new DoubleType();
406+
default -> throw new IllegalArgumentException("Unknown output type");
407+
};
408+
final int cellDim = 32; // side length for cell
415409
final Img<U> out;
416410
switch (filter) {
417411
case FRANGI:

‎src/main/java/sc/fiji/snt/tracing/TracerThread.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public TracerThread(final SNT snt, final int start_x, final int start_y, final i
5757
{
5858
this(snt, snt.getLoadedData(), start_x, start_y, start_z, goal_x, goal_y, goal_z,
5959
new Reciprocal(snt.getStats().min, snt.getStats().max),
60-
new Euclidean(snt.getImagePlus().getCalibration()));
60+
new Euclidean(snt.getCalibration()));
6161
}
6262

6363
public TracerThread(final SNT snt, final int start_x, final int start_y, final int start_z,

0 commit comments

Comments
 (0)