Loading GUI/src/main/java/cz/fidentis/analyst/distance/DistanceAction.java +29 −7 Original line number Diff line number Diff line Loading @@ -37,11 +37,14 @@ public class DistanceAction extends ControlPanelAction { private String strategy = DistancePanel.STRATEGY_POINT_TO_POINT; private boolean relativeDist = false; private boolean weightedDist = false; private boolean heatmapRender = false; private Map<MeshFacet, List<Double>> weightedHausdorffDistance = null; private final DistancePanel controlPanel; private static final Color FEATURE_POINT_HIGHLIGHT_COLOR = Color.MAGENTA; /** * Constructor. * Loading @@ -51,6 +54,27 @@ public class DistanceAction extends ControlPanelAction { public DistanceAction(Canvas canvas, JTabbedPane topControlPanel) { super(canvas, topControlPanel); this.controlPanel = new DistancePanel(this, getSecondaryFeaturePoints().getFeaturePoints()); // Place control panel to the topControlPanel topControlPanel.addTab(controlPanel.getName(), controlPanel.getIcon(), controlPanel); topControlPanel.addChangeListener(e -> { // If the distance panel is focused... if (((JTabbedPane) e.getSource()).getSelectedComponent() instanceof DistancePanel) { // ... display heatmap and feature points relevant to the Hausdorff distance getCanvas().getScene().setDefaultColors(); final List<FeaturePoint> secondaryFeaturePoints = getSecondaryFeaturePoints().getFeaturePoints(); for (int i = 0; i < secondaryFeaturePoints.size(); i++) { if (featurePointTypes.containsKey(secondaryFeaturePoints.get(i).getFeaturePointType())) { getSecondaryFeaturePoints().setColor(i, FEATURE_POINT_HIGHLIGHT_COLOR); } } visitor = null; // recompute (position of faces could have been changed in registration) calculateHausdorffDistance(); getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); renderScene(); } }); topControlPanel.setSelectedComponent(controlPanel); // Focus Hausdorff distance panel } @Override Loading @@ -58,16 +82,14 @@ public class DistanceAction extends ControlPanelAction { final String action = ae.getActionCommand(); switch (action) { case DistancePanel.ACTION_COMMAND_SHOW_HIDE_PANEL: hideShowPanelActionPerformed(ae, this.controlPanel); break; case DistancePanel.ACTION_COMMAND_SHOW_HIDE_HEATMAP: if (((JToggleButton) ae.getSource()).isSelected()) { calculateHausdorffDistance(); getSecondaryDrawableFace().setRenderHeatmap(true); heatmapRender = true; } else { getSecondaryDrawableFace().setRenderHeatmap(false); heatmapRender = false; } getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); break; case DistancePanel.ACTION_COMMAND_SET_DISTANCE_STRATEGY: strategy = (String) ((JComboBox) ae.getSource()).getSelectedItem(); Loading Loading @@ -103,7 +125,7 @@ public class DistanceAction extends ControlPanelAction { * (Re)calculates the Hausdorff distance and updates the heat map of the secondary face * as well as values of all appropriate GUI elements of {@link DistancePanel}. */ protected void calculateHausdorffDistance() { private void calculateHausdorffDistance() { final Strategy useStrategy; switch (strategy) { case DistancePanel.STRATEGY_POINT_TO_POINT: Loading Loading @@ -213,7 +235,7 @@ public class DistanceAction extends ControlPanelAction { final DrawableFeaturePoints secondaryFeaturePoints = getSecondaryFeaturePoints(); if (((JToggleButton) actionEvent.getSource()).isSelected()) { secondaryFeaturePoints.setColor(index, Color.MAGENTA); secondaryFeaturePoints.setColor(index, FEATURE_POINT_HIGHLIGHT_COLOR); featurePointTypes.put(fpType, secondaryFeaturePoints.getSize(index)); } else { secondaryFeaturePoints.resetColorToDefault(index); Loading GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationAction.java +22 −12 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import javax.vecmath.Vector3d; * * @author Richard Pajersky * @author Radek Oslejsek * @author Daniel Schramm */ public class RegistrationAction extends ControlPanelAction { Loading @@ -42,6 +43,7 @@ public class RegistrationAction extends ControlPanelAction { private HausdorffDistance hdVisitor = null; private String strategy = RegistrationPanel.STRATEGY_POINT_TO_POINT; private boolean relativeDist = false; private boolean heatmapRender = false; /* * Coloring threshold and statistical values of feature point distances: Loading @@ -59,6 +61,22 @@ public class RegistrationAction extends ControlPanelAction { public RegistrationAction(Canvas canvas, JTabbedPane topControlPanel) { super(canvas, topControlPanel); this.controlPanel = new RegistrationPanel(this); // Place control panel to the topControlPanel topControlPanel.addTab(controlPanel.getName(), controlPanel.getIcon(), controlPanel); topControlPanel.addChangeListener(e -> { // If the registration panel is focused... if (((JTabbedPane) e.getSource()).getSelectedComponent() instanceof RegistrationPanel) { // ... display heatmap and feature points relevant to the registration getCanvas().getScene().setDefaultColors(); calculateFeaturePoints(); setHeatmap(); getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); renderScene(); } }); topControlPanel.setSelectedComponent(controlPanel); // Focus registration panel calculateHausdorffDistance(); } @Override Loading @@ -67,15 +85,6 @@ public class RegistrationAction extends ControlPanelAction { String action = ae.getActionCommand(); switch (action) { case RegistrationPanel.ACTION_COMMAND_SHOW_HIDE_PANEL: hideShowPanelActionPerformed(ae, this.controlPanel); if (((JToggleButton) ae.getSource()).isSelected()) { calculateFeaturePoints(); // color points calculateHausdorffDistance(); } else { this.getCanvas().getScene().setDefaultColors(); } break; case RegistrationPanel.ACTION_COMMAND_APPLY_ICP: applyICP(); calculateFeaturePoints(); Loading Loading @@ -225,10 +234,11 @@ public class RegistrationAction extends ControlPanelAction { if (((JToggleButton) ae.getSource()).isSelected()) { calculateHausdorffDistance(); setHeatmap(); getSecondaryDrawableFace().setRenderHeatmap(true); heatmapRender = true; } else { getSecondaryDrawableFace().setRenderHeatmap(false); heatmapRender = false; } getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); break; case RegistrationPanel.ACTION_COMMAND_HD_STRATEGY: strategy = (String) ((JComboBox) ae.getSource()).getSelectedItem(); Loading Loading @@ -283,7 +293,7 @@ public class RegistrationAction extends ControlPanelAction { /** * Calculates feature points which are too far away * and changes their color to red * and changes their color to green * otherwise set color to default */ private void calculateFeaturePoints() { Loading GUI/src/main/java/cz/fidentis/analyst/toolbar/FaceToFaceToolBar.java +5 −28 Original line number Diff line number Diff line package cz.fidentis.analyst.toolbar; import cz.fidentis.analyst.canvas.Canvas; import cz.fidentis.analyst.core.ControlPanel; import cz.fidentis.analyst.distance.DistanceAction; import cz.fidentis.analyst.distance.DistancePanel; import cz.fidentis.analyst.registration.RegistrationAction; import cz.fidentis.analyst.registration.RegistrationPanel; import javax.swing.JTabbedPane; import javax.swing.JToggleButton; import org.openide.util.NbBundle; /** * A toolbar extension for the analysis of two faces. * * @author Radek Oslejsek * @author Daniel Schramm */ public class FaceToFaceToolBar extends RenderingToolBar { Loading @@ -27,28 +23,9 @@ public class FaceToFaceToolBar extends RenderingToolBar { super(canvas); addPrimaryFaceButton(); addSecondaryFaceButton(); addSeparator(); addDistanceButton(controlPanel); addRegistrationButton(controlPanel); } private void addDistanceButton(JTabbedPane controlPanel) { JToggleButton button = new JToggleButton(); button.addActionListener(new DistanceAction(getCanvas(), controlPanel)); button.setActionCommand(ControlPanel.ACTION_COMMAND_SHOW_HIDE_PANEL); button.setIcon(DistancePanel.getStaticIcon()); button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.distance.text")); add(button); button.doClick(); // show } private void addRegistrationButton(JTabbedPane controlPanel) { JToggleButton button = new JToggleButton(); button.addActionListener(new RegistrationAction(getCanvas(), controlPanel)); button.setActionCommand(ControlPanel.ACTION_COMMAND_SHOW_HIDE_PANEL); button.setIcon(RegistrationPanel.getStaticIcon()); button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.registration.text")); add(button); button.doClick(); // show // Add distance panel to the control panel new DistanceAction(getCanvas(), controlPanel); // Add registration panel to the control panel new RegistrationAction(getCanvas(), controlPanel); } } Loading
GUI/src/main/java/cz/fidentis/analyst/distance/DistanceAction.java +29 −7 Original line number Diff line number Diff line Loading @@ -37,11 +37,14 @@ public class DistanceAction extends ControlPanelAction { private String strategy = DistancePanel.STRATEGY_POINT_TO_POINT; private boolean relativeDist = false; private boolean weightedDist = false; private boolean heatmapRender = false; private Map<MeshFacet, List<Double>> weightedHausdorffDistance = null; private final DistancePanel controlPanel; private static final Color FEATURE_POINT_HIGHLIGHT_COLOR = Color.MAGENTA; /** * Constructor. * Loading @@ -51,6 +54,27 @@ public class DistanceAction extends ControlPanelAction { public DistanceAction(Canvas canvas, JTabbedPane topControlPanel) { super(canvas, topControlPanel); this.controlPanel = new DistancePanel(this, getSecondaryFeaturePoints().getFeaturePoints()); // Place control panel to the topControlPanel topControlPanel.addTab(controlPanel.getName(), controlPanel.getIcon(), controlPanel); topControlPanel.addChangeListener(e -> { // If the distance panel is focused... if (((JTabbedPane) e.getSource()).getSelectedComponent() instanceof DistancePanel) { // ... display heatmap and feature points relevant to the Hausdorff distance getCanvas().getScene().setDefaultColors(); final List<FeaturePoint> secondaryFeaturePoints = getSecondaryFeaturePoints().getFeaturePoints(); for (int i = 0; i < secondaryFeaturePoints.size(); i++) { if (featurePointTypes.containsKey(secondaryFeaturePoints.get(i).getFeaturePointType())) { getSecondaryFeaturePoints().setColor(i, FEATURE_POINT_HIGHLIGHT_COLOR); } } visitor = null; // recompute (position of faces could have been changed in registration) calculateHausdorffDistance(); getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); renderScene(); } }); topControlPanel.setSelectedComponent(controlPanel); // Focus Hausdorff distance panel } @Override Loading @@ -58,16 +82,14 @@ public class DistanceAction extends ControlPanelAction { final String action = ae.getActionCommand(); switch (action) { case DistancePanel.ACTION_COMMAND_SHOW_HIDE_PANEL: hideShowPanelActionPerformed(ae, this.controlPanel); break; case DistancePanel.ACTION_COMMAND_SHOW_HIDE_HEATMAP: if (((JToggleButton) ae.getSource()).isSelected()) { calculateHausdorffDistance(); getSecondaryDrawableFace().setRenderHeatmap(true); heatmapRender = true; } else { getSecondaryDrawableFace().setRenderHeatmap(false); heatmapRender = false; } getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); break; case DistancePanel.ACTION_COMMAND_SET_DISTANCE_STRATEGY: strategy = (String) ((JComboBox) ae.getSource()).getSelectedItem(); Loading Loading @@ -103,7 +125,7 @@ public class DistanceAction extends ControlPanelAction { * (Re)calculates the Hausdorff distance and updates the heat map of the secondary face * as well as values of all appropriate GUI elements of {@link DistancePanel}. */ protected void calculateHausdorffDistance() { private void calculateHausdorffDistance() { final Strategy useStrategy; switch (strategy) { case DistancePanel.STRATEGY_POINT_TO_POINT: Loading Loading @@ -213,7 +235,7 @@ public class DistanceAction extends ControlPanelAction { final DrawableFeaturePoints secondaryFeaturePoints = getSecondaryFeaturePoints(); if (((JToggleButton) actionEvent.getSource()).isSelected()) { secondaryFeaturePoints.setColor(index, Color.MAGENTA); secondaryFeaturePoints.setColor(index, FEATURE_POINT_HIGHLIGHT_COLOR); featurePointTypes.put(fpType, secondaryFeaturePoints.getSize(index)); } else { secondaryFeaturePoints.resetColorToDefault(index); Loading
GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationAction.java +22 −12 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import javax.vecmath.Vector3d; * * @author Richard Pajersky * @author Radek Oslejsek * @author Daniel Schramm */ public class RegistrationAction extends ControlPanelAction { Loading @@ -42,6 +43,7 @@ public class RegistrationAction extends ControlPanelAction { private HausdorffDistance hdVisitor = null; private String strategy = RegistrationPanel.STRATEGY_POINT_TO_POINT; private boolean relativeDist = false; private boolean heatmapRender = false; /* * Coloring threshold and statistical values of feature point distances: Loading @@ -59,6 +61,22 @@ public class RegistrationAction extends ControlPanelAction { public RegistrationAction(Canvas canvas, JTabbedPane topControlPanel) { super(canvas, topControlPanel); this.controlPanel = new RegistrationPanel(this); // Place control panel to the topControlPanel topControlPanel.addTab(controlPanel.getName(), controlPanel.getIcon(), controlPanel); topControlPanel.addChangeListener(e -> { // If the registration panel is focused... if (((JTabbedPane) e.getSource()).getSelectedComponent() instanceof RegistrationPanel) { // ... display heatmap and feature points relevant to the registration getCanvas().getScene().setDefaultColors(); calculateFeaturePoints(); setHeatmap(); getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); renderScene(); } }); topControlPanel.setSelectedComponent(controlPanel); // Focus registration panel calculateHausdorffDistance(); } @Override Loading @@ -67,15 +85,6 @@ public class RegistrationAction extends ControlPanelAction { String action = ae.getActionCommand(); switch (action) { case RegistrationPanel.ACTION_COMMAND_SHOW_HIDE_PANEL: hideShowPanelActionPerformed(ae, this.controlPanel); if (((JToggleButton) ae.getSource()).isSelected()) { calculateFeaturePoints(); // color points calculateHausdorffDistance(); } else { this.getCanvas().getScene().setDefaultColors(); } break; case RegistrationPanel.ACTION_COMMAND_APPLY_ICP: applyICP(); calculateFeaturePoints(); Loading Loading @@ -225,10 +234,11 @@ public class RegistrationAction extends ControlPanelAction { if (((JToggleButton) ae.getSource()).isSelected()) { calculateHausdorffDistance(); setHeatmap(); getSecondaryDrawableFace().setRenderHeatmap(true); heatmapRender = true; } else { getSecondaryDrawableFace().setRenderHeatmap(false); heatmapRender = false; } getSecondaryDrawableFace().setRenderHeatmap(heatmapRender); break; case RegistrationPanel.ACTION_COMMAND_HD_STRATEGY: strategy = (String) ((JComboBox) ae.getSource()).getSelectedItem(); Loading Loading @@ -283,7 +293,7 @@ public class RegistrationAction extends ControlPanelAction { /** * Calculates feature points which are too far away * and changes their color to red * and changes their color to green * otherwise set color to default */ private void calculateFeaturePoints() { Loading
GUI/src/main/java/cz/fidentis/analyst/toolbar/FaceToFaceToolBar.java +5 −28 Original line number Diff line number Diff line package cz.fidentis.analyst.toolbar; import cz.fidentis.analyst.canvas.Canvas; import cz.fidentis.analyst.core.ControlPanel; import cz.fidentis.analyst.distance.DistanceAction; import cz.fidentis.analyst.distance.DistancePanel; import cz.fidentis.analyst.registration.RegistrationAction; import cz.fidentis.analyst.registration.RegistrationPanel; import javax.swing.JTabbedPane; import javax.swing.JToggleButton; import org.openide.util.NbBundle; /** * A toolbar extension for the analysis of two faces. * * @author Radek Oslejsek * @author Daniel Schramm */ public class FaceToFaceToolBar extends RenderingToolBar { Loading @@ -27,28 +23,9 @@ public class FaceToFaceToolBar extends RenderingToolBar { super(canvas); addPrimaryFaceButton(); addSecondaryFaceButton(); addSeparator(); addDistanceButton(controlPanel); addRegistrationButton(controlPanel); } private void addDistanceButton(JTabbedPane controlPanel) { JToggleButton button = new JToggleButton(); button.addActionListener(new DistanceAction(getCanvas(), controlPanel)); button.setActionCommand(ControlPanel.ACTION_COMMAND_SHOW_HIDE_PANEL); button.setIcon(DistancePanel.getStaticIcon()); button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.distance.text")); add(button); button.doClick(); // show } private void addRegistrationButton(JTabbedPane controlPanel) { JToggleButton button = new JToggleButton(); button.addActionListener(new RegistrationAction(getCanvas(), controlPanel)); button.setActionCommand(ControlPanel.ACTION_COMMAND_SHOW_HIDE_PANEL); button.setIcon(RegistrationPanel.getStaticIcon()); button.setToolTipText(NbBundle.getMessage(RenderingToolBar.class, "FaceToFaceToolBar.registration.text")); add(button); button.doClick(); // show // Add distance panel to the control panel new DistanceAction(getCanvas(), controlPanel); // Add registration panel to the control panel new RegistrationAction(getCanvas(), controlPanel); } }