diff --git a/Comparison/src/main/java/cz/fidentis/analyst/face/events/SymmetryPlaneChangedEvent.java b/Comparison/src/main/java/cz/fidentis/analyst/face/events/SymmetryPlaneChangedEvent.java index 919a7570994e33c02978fe48b68927aa176e98bf..f171633aceccb3b150c38fca80be6f7a43362e47 100644 --- a/Comparison/src/main/java/cz/fidentis/analyst/face/events/SymmetryPlaneChangedEvent.java +++ b/Comparison/src/main/java/cz/fidentis/analyst/face/events/SymmetryPlaneChangedEvent.java @@ -3,7 +3,7 @@ package cz.fidentis.analyst.face.events; import cz.fidentis.analyst.face.HumanFace; /** - * New symmetry plane has been changed. + * New symmetry plane has been added or changed (transformed). * * @author Radek Oslejsek */ diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/ApproxHausdorffDistTask.java b/GUI/src/main/java/cz/fidentis/analyst/batch/ApproxHausdorffDistTask.java index b904a5254cc4840bfd547d21a9ac2847da0dd87f..0a18717db2f118eaa3d099f45b2b53d6b38f0654 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/ApproxHausdorffDistTask.java +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/ApproxHausdorffDistTask.java @@ -106,7 +106,7 @@ public class ApproxHausdorffDistTask extends SimilarityTask { .stream() .flatMap(List::stream) .collect(Collectors.toList())); - face.removeKdTree(); // TO BE TESTED + face.removeKdTree(); // k-d tree construction is fast, and the memory is more valuable hdComputationTime.stop(); } else { @@ -176,7 +176,7 @@ public class ApproxHausdorffDistTask extends SimilarityTask { for (int i = 0; i < distCache.size(); i++) { for (int j = i; j < distCache.size(); j++) { - assert(distCache.get(i).size() == distCache.get(i).size()); // should never happen + //assert(distCache.get(i).size() == distCache.get(i).size()); // should never happen final int fi = i; final int fj = j; @@ -206,11 +206,8 @@ public class ApproxHausdorffDistTask extends SimilarityTask { executor.shutdown(); while (!executor.isTerminated()){} try { - int i = 0; for (Future<Void> res: results) { res.get(); // waits until all computations are finished - int progress = (int) Math.round(100.0 * (i+1) / results.size()); - getProgressDialog().setValue(progress); } } catch (final InterruptedException | ExecutionException ex) { java.util.logging.Logger.getLogger(ApproxHausdorffDistTask.class.getName()).log(Level.SEVERE, null, ex); diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/CompleteHausdorffDistTask.java b/GUI/src/main/java/cz/fidentis/analyst/batch/CompleteHausdorffDistTask.java index 489c17960d96593b11d8566b2837b87a578786d5..ea7eec93a4bd0b919116521f70f219f0b9515af7 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/CompleteHausdorffDistTask.java +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/CompleteHausdorffDistTask.java @@ -68,7 +68,7 @@ public class CompleteHausdorffDistTask extends SimilarityTask { HausdorffDistance.Strategy.POINT_TO_POINT, false, // relative true, // parallel - false // crop + true // crop ); secFace.getMeshModel().compute(hd, true); setDistSimilarity(j, i, hd.getStats().getAverage()); diff --git a/GUI/src/main/java/cz/fidentis/analyst/batch/IcpTask.java b/GUI/src/main/java/cz/fidentis/analyst/batch/IcpTask.java index 8dac7dd7588086c35c14684aee8c10f990023f12..a6b375c9bcb43e21c0734ef76cc2c714a1b5f24f 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/batch/IcpTask.java +++ b/GUI/src/main/java/cz/fidentis/analyst/batch/IcpTask.java @@ -34,7 +34,10 @@ public class IcpTask extends SwingWorker<MeshModel, HumanFace> { private int faceSceneSlot = -1; // scene slot to show the transformed face - private final int initialFaceIndex; // index of initial face in the list of available faces + /** + * Index of initial face in the list of available faces + */ + private final int initialFaceIndex; private final Stopwatch totalTime = new Stopwatch("Total computation time:\t"); private final Stopwatch avgFaceComputationTime = new Stopwatch("AVG face computation time:\t"); @@ -57,12 +60,6 @@ public class IcpTask extends SwingWorker<MeshModel, HumanFace> { this.initialFaceIndex = initialFaceIndex; - //try { - // avgFace = new HumanFace(controlPanel.getFaces().get(controlPanel.getTemplateFaceIndex()).toFile()); - //} catch (IOException ex) { - // throw new IllegalArgumentException(ex); - //} - this.progressDialog = progressDialog; this.controlPanel = controlPanel; this.canvas = canvas; @@ -104,11 +101,7 @@ public class IcpTask extends SwingWorker<MeshModel, HumanFace> { HumanFace face = factory.getFace(faceId); loadTime.stop(); - kdTreeConstructionTime.start(); - face.computeKdTree(false); - kdTreeConstructionTime.stop(); - - if (computeICP) { // ICP registration: + if (computeICP) { // ICP registration - face is transformed! icpComputationTime.start(); IcpTransformer icp = new IcpTransformer( initFace.getMeshModel(), @@ -119,8 +112,12 @@ public class IcpTask extends SwingWorker<MeshModel, HumanFace> { face.getMeshModel().compute(icp, true); // superimpose face towards the initFace icpComputationTime.stop(); } - + if (computeAvgFace) { // AVG template face + kdTreeConstructionTime.start(); + face.computeKdTree(computeICP); // if transformed by ICP, force rk-d tree e-computation + kdTreeConstructionTime.stop(); + avgFaceComputationTime.start(); if (avgFaceConstructor == null) { avgFaceConstructor = new AvgFaceConstructor(initFace.getMeshModel()); @@ -129,12 +126,8 @@ public class IcpTask extends SwingWorker<MeshModel, HumanFace> { avgFaceComputationTime.stop(); } - // Preserving k-d tree could accelerate the recomputation of ICP or average face, - // but slows down the approximative computation of distace where - // only k-d tree of the template face is necessary (or is not used at all) - face.removeKdTree(); // TO BE TESTED - - publish(face); // update progress bar and possibly render the transformed face + face.removeKdTree(); // k-d tree construction is fast, and a free memory is more required + publish(face); // update progress bar and possibly render the transformed face } int progress = (int) Math.round(100.0 * (i + 1.0) / faces.size()); diff --git a/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.form b/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.form index fa4ffe365bee96fb5abb487c5cb076425a269c8a..146a2f5abf312602f0057d3c65ad94b603a82d75 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.form +++ b/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.form @@ -43,8 +43,8 @@ </Group> <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Component id="jPanel2" max="32767" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jPanel2" alignment="0" max="32767" attributes="0"/> <Component id="jPanel4" alignment="0" max="32767" attributes="0"/> <Component id="jPanel7" alignment="0" max="32767" attributes="0"/> <Component id="transformationPanel" alignment="0" min="-2" pref="585" max="-2" attributes="0"/> @@ -75,9 +75,9 @@ <Component id="transformationPanel" min="-2" pref="209" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="jPanel4" min="-2" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> <Component id="jPanel2" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="197" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="232" max="-2" attributes="0"/> <Component id="jSeparator11" min="-2" pref="10" max="-2" attributes="0"/> <EmptySpace min="-2" pref="221" max="-2" attributes="0"/> <Component id="jSeparator2" min="-2" pref="10" max="-2" attributes="0"/> diff --git a/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.java b/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.java index ca5f6c105cd1afe92e49d58633c2b304bcb8e909..d2d56b969909d736f3f9d99f7e226d75710dbce8 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.java +++ b/GUI/src/main/java/cz/fidentis/analyst/registration/RegistrationPanel.java @@ -51,8 +51,8 @@ public class RegistrationPanel extends ControlPanel { /* * Configuration of panel-specific GUI elements */ - public static final String STRATEGY_POINT_TO_POINT= "Point to point"; - public static final String STRATEGY_POINT_TO_TRIANGLE= "Point to triangle"; + public static final String STRATEGY_POINT_TO_POINT = "Point to point"; + public static final String STRATEGY_POINT_TO_TRIANGLE = "Point to triangle"; public static final double TRANSFORMATION_FINESS = 1.0; @@ -1182,12 +1182,12 @@ public class RegistrationPanel extends ControlPanel { .addGap(450, 450, 450)) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(transformationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(transformationPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(153, 153, 153) .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) @@ -1208,9 +1208,9 @@ public class RegistrationPanel extends ControlPanel { .addComponent(transformationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(197, 197, 197) + .addGap(232, 232, 232) .addComponent(jSeparator11, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(221, 221, 221) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)