From aaf65ed8c5be858d8491bc2d8c217bdb5caf44a8 Mon Sep 17 00:00:00 2001 From: Tiago Ferreira Date: Wed, 25 Oct 2023 14:53:00 -0400 Subject: [PATCH] Code cleanup and minor fixes - Cleanup pom - DemoRunner: Remove unimplemented code - SigmaPalette: Workaround startup NPE on MacOS - PathManagerUI: Remove legacy option - Jython Template: Ensure imported classes appear in Ctrl+Space auto-completion - Script: Remove outdated LUT option --- pom.xml | 17 +++--- src/main/java/sc/fiji/snt/PathManagerUI.java | 3 -- src/main/java/sc/fiji/snt/gui/DemoRunner.java | 53 ++++++++++--------- .../java/sc/fiji/snt/gui/SigmaPalette.java | 3 +- .../Neuroanatomy/Boilerplate/PY.py | 4 +- ...ollection_2D_(Skeletonized_Montage).groovy | 2 +- 6 files changed, 39 insertions(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index 8e86f11ae..b3bace0a3 100644 --- a/pom.xml +++ b/pom.xml @@ -143,22 +143,18 @@ 906892d db26f01 6.4.2 - 3.2.1 - 3.2.2 - 2.20.0 - 3.0.2 + 3.2.5 + ${flatlaf.version} + 2.21.0 3.7.14 - 13.0 + 24.0.1 8.5.12 - 0.14 - 3.7.12 - 2.19.0 ${log4j.version} ${log4j.version} 0.8.0 ba959ae644 - 3.0.0 - 3.0.2 + 3.0.2 + ${smile.version} ${smile.version} @@ -453,7 +449,6 @@ org.jheaps jheaps - ${jheaps.version} sc.iview diff --git a/src/main/java/sc/fiji/snt/PathManagerUI.java b/src/main/java/sc/fiji/snt/PathManagerUI.java index f413f3b92..c8b5d1903 100644 --- a/src/main/java/sc/fiji/snt/PathManagerUI.java +++ b/src/main/java/sc/fiji/snt/PathManagerUI.java @@ -2114,9 +2114,6 @@ private void runDistributionAnalysisCmd(final Collection trees, final Stri input.put("calledFromPathManagerUI", true); if (metric != null) input.put("measurementChoice", metric); if (polar != null) input.put("polar", polar); - if (trees.size() == 1) { - input.put("onlyConnectivitySafeMetrics", false); - } cmdService.run(DistributionCPCmd.class, true, input); } diff --git a/src/main/java/sc/fiji/snt/gui/DemoRunner.java b/src/main/java/sc/fiji/snt/gui/DemoRunner.java index 424a797d8..6ad3e5360 100644 --- a/src/main/java/sc/fiji/snt/gui/DemoRunner.java +++ b/src/main/java/sc/fiji/snt/gui/DemoRunner.java @@ -65,7 +65,7 @@ public DemoRunner(final SNTUI ui, final SNT snt) { entries.add(demo7()); entries.add(demo8()); entries.add(demo9()); - entries.add(demo10()); + //entries.add(demo10()); } private Demo demo1() { @@ -73,7 +73,8 @@ private Demo demo1() { @Override public ImagePlus getImage() { final ImagePlus imp = sntService.demoImage("ddaC"); - imp.setRoi(320, 380, 20, 20); // mark soma + if (imp != null) + imp.setRoi(320, 380, 20, 20); // mark soma return imp; } @@ -254,30 +255,30 @@ public void load() { return entry; } - private Demo demo10() { - final Demo entry = new Demo(10, "Segmented astrocyte (2D image)") { - @Override - public ImagePlus getImage() { - final ImagePlus imp = ij.IJ.openImage("http://wsr.imagej.net/images/mitosis.tif"); - imp.setPosition(2, 4, 31); // k-fibers channel, mid Z-range, traced time point - return imp; - } - - @Override - public void load() { - super.load(); - // apply tags - ui.getPathManager().applyDefaultTags("Traced Channel"); - ui.getPathManager().applyDefaultTags("Traced Frame"); - } - }; - entry.summary = "Downloads a Drosophila S2 cell undergoing mitosis in which K-fibers were traced during anaphase."; - entry.data = "Image (5D; 2-channel, 3D timelapse, 33MB)"; - entry.source = "ImageJ sample image, PMID 19720876"; - entry.online = true; - entry.tracingsURL = "https://raw.githubusercontent.com/morphonets/SNTmanuscript/718e4b90fb4bb61f382edcf467173b53045b25e0/FigS3_5D-Tracing/traces/mitosis.traces"; - return entry; - } +// private Demo demo10() { +// final Demo entry = new Demo(10, "Segmented astrocyte (2D image)") { +// @Override +// public ImagePlus getImage() { +// final ImagePlus imp = ij.IJ.openImage("http://wsr.imagej.net/images/mitosis.tif"); +// imp.setPosition(2, 4, 31); // k-fibers channel, mid Z-range, traced time point +// return imp; +// } +// +// @Override +// public void load() { +// super.load(); +// // apply tags +// ui.getPathManager().applyDefaultTags("Traced Channel"); +// ui.getPathManager().applyDefaultTags("Traced Frame"); +// } +// }; +// entry.summary = "Downloads a Drosophila S2 cell undergoing mitosis in which K-fibers were traced during anaphase."; +// entry.data = "Image (5D; 2-channel, 3D timelapse, 33MB)"; +// entry.source = "ImageJ sample image, PMID 19720876"; +// entry.online = true; +// entry.tracingsURL = "https://raw.githubusercontent.com/morphonets/SNTmanuscript/718e4b90fb4bb61f382edcf467173b53045b25e0/FigS3_5D-Tracing/traces/mitosis.traces"; +// return entry; +// } private void error(final Throwable ex) { ui.error("Loading of data failed (" + ex.getMessage() + " error). See Console for details."); diff --git a/src/main/java/sc/fiji/snt/gui/SigmaPalette.java b/src/main/java/sc/fiji/snt/gui/SigmaPalette.java index 7bfe615b9..d6536016a 100644 --- a/src/main/java/sc/fiji/snt/gui/SigmaPalette.java +++ b/src/main/java/sc/fiji/snt/gui/SigmaPalette.java @@ -568,7 +568,8 @@ private void updateSigmaFromMouseEvent(final MouseEvent e) { } } updateOverlayLabels(); - paletteWindow.repaint(); // call createSubtitle() + if (paletteWindow != null) + paletteWindow.repaint(); // call createSubtitle() mouseMovedAcceptedSigmaIndex = -1; } } diff --git a/src/main/resources/script_templates/Neuroanatomy/Boilerplate/PY.py b/src/main/resources/script_templates/Neuroanatomy/Boilerplate/PY.py index 22cf5c2dd..88214e1f6 100644 --- a/src/main/resources/script_templates/Neuroanatomy/Boilerplate/PY.py +++ b/src/main/resources/script_templates/Neuroanatomy/Boilerplate/PY.py @@ -15,7 +15,9 @@ """ from sc.fiji.snt import Path, PathAndFillManager, SNT, SNTUI, Tree -from sc.fiji.snt.analysis import * +from sc.fiji.snt.analysis import GroupedTreeStatistics, MultiTreeStatistics, NodeStatistics, TreeStatistics,\ + ConvexHullAnalyzer, PersistenceAnalyzer, ShollAnalyzer, StrahlerAnalyzer, NodeColorMapper,\ + TreeColorMapper, PathProfiler, PathStraightener, RoiConverter, SkeletonConverter, SNTChart, SNTTable from sc.fiji.snt.analysis.graph import DirectedWeightedGraph from sc.fiji.snt.analysis.sholl.parsers import TreeParser from sc.fiji.snt.annotation import AllenCompartment, AllenUtils, VFBUtils, ZBAtlasUtils diff --git a/src/main/resources/script_templates/Neuroanatomy/Render/Render_Cell_Collection_2D_(Skeletonized_Montage).groovy b/src/main/resources/script_templates/Neuroanatomy/Render/Render_Cell_Collection_2D_(Skeletonized_Montage).groovy index 34c1440f7..d7bd2311d 100644 --- a/src/main/resources/script_templates/Neuroanatomy/Render/Render_Cell_Collection_2D_(Skeletonized_Montage).groovy +++ b/src/main/resources/script_templates/Neuroanatomy/Render/Render_Cell_Collection_2D_(Skeletonized_Montage).groovy @@ -3,7 +3,7 @@ #@ int (label="Number of columns", value=0) columns #@ int (label="Number of rows", value=0) rows #@ Float (label="Scale factor for reconstructions", value=1.0) scale -#@ String (label="Color mapping:", choices={"Ice.lut", "mpl-viridis.lut", "glasbey_on_dark.lut"}, value="glasbey_on_dark.lut") lutName +#@ String (label="Color mapping:", choices={"mpl-viridis.lut", "glasbey_on_dark.lut"}, value="glasbey_on_dark.lut") lutName #@ SNTService snt /**