Skip to content

Commit

Permalink
Workaround exception in Viewer3D
Browse files Browse the repository at this point in the history
While at it, some code cleanup and tweaks
  • Loading branch information
tferr committed Oct 28, 2022
1 parent 1f85a38 commit 9a44343
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
7 changes: 5 additions & 2 deletions src/main/java/sc/fiji/snt/gui/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,16 @@ public static JDialog showAboutDialog() {
final JLabel ijDetails = leftAlignedLabel(
"ImageJ " + ImageJ.VERSION + ImageJ.BUILD + " | Java " + System.getProperty("java.version"), "", true);
ijDetails.setAlignmentX(JLabel.CENTER_ALIGNMENT);
ijDetails.setToolTipText("Displays detailed System Information");
ijDetails.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (IJ.getInstance() == null)
new ij.plugin.JavaProperties().run("");
else
IJ.doCommand("ImageJ Properties");
else {
//IJ.doCommand("ImageJ Properties");
IJ.doCommand("System Information");
}
}

});
Expand Down
35 changes: 14 additions & 21 deletions src/main/java/sc/fiji/snt/gui/cmds/PathFitterCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,17 @@ public class PathFitterCmd extends ContextCommand {
@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String msg1 = HEADER +
"<b>Type of refinement:</b> SNT can use the fluorescent signal around traced paths " //
+
"to optimize curvatures and estimate the thickness of traced structures. The optimization " //
+
"algorithm uses pixel intensities to fit circular cross-sections around each node. " //
+
"Once computed, fitted cross-sections can be use to: 1) Infer the radius of nodes, " //
+
"and/or 2) refine node positioning, by snapping their coordinates to the cross-section " //
+ "centroid.<br><br>" //
+
"Please specify the type of optimization to be performed when refining paths:";

+ "to optimize curvatures and estimate the thickness of traced structures. The optimization " //
+ "algorithm uses pixel intensities to fit circular cross-sections around each node. " //
+ "Once computed, fitted cross-sections can be use to: 1) Infer the radius of nodes, " //
+ "and/or 2) refine node positioning, by snapping their coordinates to the cross-section " //
+ "centroid. Please specify the type of optimization to be performed when refining paths:";
@Parameter(required = true, label = EMPTY_LABEL, choices = { CHOICE_RADII,
CHOICE_MIDPOINT, CHOICE_BOTH })
private String fitChoice;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String spacer = EMPTY_LABEL;
// @Parameter(required = false, visibility = ItemVisibility.MESSAGE)
// private final String spacer = EMPTY_LABEL;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String msg2 = HEADER +
Expand All @@ -102,17 +95,17 @@ public class PathFitterCmd extends ContextCommand {
+ "and repeat fitting in smaller increments")
private int maxRadius = PathFitter.DEFAULT_MAX_RADIUS;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String spacer2 = EMPTY_LABEL;
// @Parameter(required = false, visibility = ItemVisibility.MESSAGE)
// private final String spacer2 = EMPTY_LABEL;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String msg3 = HEADER +
"<b>Target image:</b> Which image should be used for fitting?";
@Parameter(required = false, label = EMPTY_LABEL, choices= {"Main image", "Secondary (if available)"})
private String impChoice;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String spacer3 = EMPTY_LABEL;
// @Parameter(required = false, visibility = ItemVisibility.MESSAGE)
// private final String spacer3 = EMPTY_LABEL;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String msg4 = HEADER +
Expand All @@ -123,13 +116,13 @@ public class PathFitterCmd extends ContextCommand {
"Keep original path(s)", "Replace existing nodes (undoable operation)" })
private String fitInPlaceChoice;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE)
private final String spacer4 = EMPTY_LABEL;
// @Parameter(required = false, visibility = ItemVisibility.MESSAGE)
// private final String spacer4 = EMPTY_LABEL;

@Parameter(required = false, visibility = ItemVisibility.MESSAGE,
description="Press 'Reset' or set it to 0 to use the available processors on your computer")
private final String msg5 = HEADER +
"<b>Multithreading:</b> Number of parallel threads:";
"<b>Multithreading:</b> Number of parallel threads to compute fits:";

@Parameter(required = false, label = EMPTY_LABEL, persist = false, min = "0", stepSize = "1")
private int nThreads = SNTPrefs.getThreads();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sc/fiji/snt/gui/cmds/ShortcutWindowCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private boolean supported(final File file) {
final String filename = file.getName().toLowerCase();
return (filename.endsWith(".traces")) || (filename.endsWith("swc")) || (filename.endsWith(".json"));
}

final void importFile(final File file) {
final Collection<Tree> trees = Tree.listFromFile(file.getAbsolutePath());
if (trees == null || trees.isEmpty()) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/sc/fiji/snt/viewer/Viewer3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,8 @@ private void removeCollection(final Collection<?> collection) {

@SuppressWarnings("unchecked")
private List<String> getLabelsCheckedInManager() {
if (managerList.getCheckBoxListSelectionModel().isSelectionEmpty())
return Arrays.asList(new String[] {""}); // workaround Exception in getCheckBoxListSelectedValues
final Object[] values = managerList.getCheckBoxListSelectedValues();
return (List<String>) (List<?>) Arrays.asList(values);
}
Expand Down

0 comments on commit 9a44343

Please sign in to comment.