Loading GUI/src/main/java/cz/fidentis/analyst/gui/project/OpenProjectAction.java +7 −6 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; Loading @@ -14,6 +9,12 @@ import org.openide.filesystems.FileChooserBuilder; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; /** * Opens an existing project. * Loading Loading @@ -74,7 +75,7 @@ public final class OpenProjectAction implements ActionListener { } win.getProjectPanel().openProject(dir); WindowManager.getDefault().getMainWindow().setTitle("FIDENTIS Analyst 2: " WindowManager.getDefault().getMainWindow().setTitle("FIDENTIS Analyst II: " + win.getProjectPanel().getProject().getProjectName()); win.requestActive(); } Loading GUI/src/main/java/cz/fidentis/analyst/gui/project/ProjectPanel.java +10 −10 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.gui.elements.ProgressDialog; import cz.fidentis.analyst.gui.project.table.ProjectTable; import cz.fidentis.analyst.gui.task.TaskWindow; import java.awt.Font; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.project.Project; import org.openide.filesystems.FileChooserBuilder; import org.openide.windows.WindowManager; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.io.File; Loading @@ -14,13 +20,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.SwingWorker; import javax.swing.event.ListSelectionEvent; import javax.swing.filechooser.FileNameExtensionFilter; import org.openide.filesystems.FileChooserBuilder; import org.openide.windows.WindowManager; /** * The left-hand part of the project dashboard consisting of a project toolbar and Loading Loading @@ -129,6 +128,7 @@ public class ProjectPanel extends javax.swing.JPanel { try { this.project = new Project(dir); } catch (IOException ex) { ex.printStackTrace(); return null; } Loading GUI/src/main/java/cz/fidentis/analyst/gui/project/RecoverTasksWorker.java +11 −8 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.gui.elements.ProgressDialog; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.rendering.Camera; import javax.swing.*; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.function.BiConsumer; import javax.swing.SwingWorker; /** * A worker for loading multiple task tabs (faces and cameras) of a project from dumped files. Loading @@ -19,7 +21,7 @@ import javax.swing.SwingWorker; public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { private Project project; private ProgressDialog progressDialog; private ProgressDialog<Boolean, Integer> progressDialog; private final BiConsumer<Camera, FacesProxy> consumer; /** Loading @@ -30,7 +32,7 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { * @param consumer A method that creates an analytical tab from loaded camera and faces * @throws IllegalArgumentException if the project has not a folder assigned */ public RecoverTasksWorker(Project project, ProgressDialog progressDialog, BiConsumer<Camera, FacesProxy> consumer) { public RecoverTasksWorker(Project project, ProgressDialog<Boolean, Integer> progressDialog, BiConsumer<Camera, FacesProxy> consumer) { if (!project.hasProjectDir()) { throw new IllegalArgumentException("project"); } Loading @@ -43,9 +45,7 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { protected Boolean doInBackground() throws Exception { File projectDir = new File(project.getProjectDir().toString()); File[] files = projectDir.listFiles((dir, name) -> { return name.toLowerCase().endsWith(".bin"); }); File[] files = projectDir.listFiles((dir, name) -> name.toLowerCase().endsWith(".bin")); int counter = 0; for (File file: files) { Loading @@ -57,6 +57,9 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { Camera camera = (Camera) in.readObject(); FacesProxy faces = new FacesProxy(in); this.consumer.accept(camera, faces); } catch (Exception ex) { Logger.print("[ERROR] Task recovery: " + ex); throw ex; } int progress = (int)Math.round(100.0 * ++counter / files.length); Loading HumanFace/src/main/java/cz/fidentis/analyst/face/HumanFace.java +13 −17 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.distance.kdtree.KdTreeApproxDistanceToTriangles; import cz.fidentis.analyst.events.HumanFaceEvent; import cz.fidentis.analyst.events.HumanFaceListener; import cz.fidentis.analyst.shapes.Box; import cz.fidentis.analyst.feature.FeaturePoint; import cz.fidentis.analyst.feature.FeaturePointType.FeaturePointCategory; import cz.fidentis.analyst.feature.RelationToMesh; Loading @@ -16,6 +15,7 @@ import cz.fidentis.analyst.mesh.CurvatureCalculator; import cz.fidentis.analyst.mesh.core.MeshModel; import cz.fidentis.analyst.mesh.io.MeshObjLoader; import cz.fidentis.analyst.octree.Octree; import cz.fidentis.analyst.shapes.Box; import cz.fidentis.analyst.shapes.Plane; import cz.fidentis.analyst.shapes.SurfaceMask; Loading @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; /** * A human face instance. Loading @@ -45,6 +44,8 @@ import java.util.stream.Collectors; */ public class HumanFace implements Serializable { public static final String LANDMARK_FILE_SUFFIX = "_landmarks.csv"; private MeshModel meshModel; /** Loading @@ -57,7 +58,6 @@ public class HumanFace implements Serializable { private Plane symmetryPlane; //private MeshFacet symmetryPlaneMesh; private Box bbox; private List<FeaturePoint> featurePoints; Loading @@ -68,7 +68,7 @@ public class HumanFace implements Serializable { private boolean hasCurvature = false; private final SurfaceMask surfaceMask = new SurfaceMask(); private final transient SurfaceMask surfaceMask = new SurfaceMask(); /** * Fast (de)serialization handler Loading Loading @@ -170,7 +170,6 @@ public class HumanFace implements Serializable { } this.meshModel = meshModel; updateBoundingBox(); //announceEvent(new MeshChangedEvent(this, getShortName(), this)); } /** Loading Loading @@ -276,6 +275,7 @@ public class HumanFace implements Serializable { /** * * @param points List of feature points * @deprecated */ @Deprecated public void setFeaturePoints(List<FeaturePoint> points) { Loading @@ -302,7 +302,6 @@ public class HumanFace implements Serializable { if (featurePoints == null) { return Collections.emptyList(); } //return Collections.unmodifiableList(featurePoints); return featurePoints; } Loading @@ -312,7 +311,7 @@ public class HumanFace implements Serializable { public List<FeaturePoint> getStandardFeaturePoints() { return getFeaturePoints().stream() .filter(fp -> fp.getFeaturePointType().getCategory() == FeaturePointCategory.STANDARD) .collect(Collectors.toList()); .toList(); } /** Loading @@ -321,7 +320,7 @@ public class HumanFace implements Serializable { public List<FeaturePoint> getCustomFeaturePoints() { return getFeaturePoints().stream() .filter(fp -> fp.getFeaturePointType().getCategory() == FeaturePointCategory.CUSTOM) .collect(Collectors.toList()); .toList(); } /** Loading Loading @@ -453,17 +452,17 @@ public class HumanFace implements Serializable { * @return The file with landmarks or {@code null} */ public final File findLandmarks() { String filename = getId().split(".obj")[0] + "_landmarks.csv"; String filename = getId().split(".obj")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } filename = getId().split("_ECA")[0] + "_landmarks.csv"; filename = getId().split("_ECA")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } filename = getId().split("_CA")[0] + "_landmarks.csv"; filename = getId().split("_CA")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } Loading Loading @@ -497,9 +496,9 @@ public class HumanFace implements Serializable { * @return relation */ protected RelationToMesh computeFeaturePointRelation(FeaturePoint featurePoint) { KdTree kdTree = computeKdTree(false); KdTree tmpKdTree = computeKdTree(false); KdTreeApproxDistanceToTriangles visitor = new KdTreeApproxDistanceToTriangles(featurePoint.getPosition(), true); kdTree.accept(visitor); tmpKdTree.accept(visitor); return new RelationToMesh(visitor.getDistance(), visitor.getNearestPoints()); } Loading @@ -521,10 +520,7 @@ public class HumanFace implements Serializable { return false; } final HumanFace other = (HumanFace) obj; if (!Objects.equals(this.id, other.id)) { return false; } return true; return Objects.equals(this.id, other.id); } Loading Loading
GUI/src/main/java/cz/fidentis/analyst/gui/project/OpenProjectAction.java +7 −6 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; Loading @@ -14,6 +9,12 @@ import org.openide.filesystems.FileChooserBuilder; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; /** * Opens an existing project. * Loading Loading @@ -74,7 +75,7 @@ public final class OpenProjectAction implements ActionListener { } win.getProjectPanel().openProject(dir); WindowManager.getDefault().getMainWindow().setTitle("FIDENTIS Analyst 2: " WindowManager.getDefault().getMainWindow().setTitle("FIDENTIS Analyst II: " + win.getProjectPanel().getProject().getProjectName()); win.requestActive(); } Loading
GUI/src/main/java/cz/fidentis/analyst/gui/project/ProjectPanel.java +10 −10 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.gui.elements.ProgressDialog; import cz.fidentis.analyst.gui.project.table.ProjectTable; import cz.fidentis.analyst.gui.task.TaskWindow; import java.awt.Font; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.project.Project; import org.openide.filesystems.FileChooserBuilder; import org.openide.windows.WindowManager; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.io.File; Loading @@ -14,13 +20,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.SwingWorker; import javax.swing.event.ListSelectionEvent; import javax.swing.filechooser.FileNameExtensionFilter; import org.openide.filesystems.FileChooserBuilder; import org.openide.windows.WindowManager; /** * The left-hand part of the project dashboard consisting of a project toolbar and Loading Loading @@ -129,6 +128,7 @@ public class ProjectPanel extends javax.swing.JPanel { try { this.project = new Project(dir); } catch (IOException ex) { ex.printStackTrace(); return null; } Loading
GUI/src/main/java/cz/fidentis/analyst/gui/project/RecoverTasksWorker.java +11 −8 Original line number Diff line number Diff line package cz.fidentis.analyst.gui.project; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.gui.elements.ProgressDialog; import cz.fidentis.analyst.project.FacesProxy; import cz.fidentis.analyst.project.Project; import cz.fidentis.analyst.rendering.Camera; import javax.swing.*; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.util.function.BiConsumer; import javax.swing.SwingWorker; /** * A worker for loading multiple task tabs (faces and cameras) of a project from dumped files. Loading @@ -19,7 +21,7 @@ import javax.swing.SwingWorker; public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { private Project project; private ProgressDialog progressDialog; private ProgressDialog<Boolean, Integer> progressDialog; private final BiConsumer<Camera, FacesProxy> consumer; /** Loading @@ -30,7 +32,7 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { * @param consumer A method that creates an analytical tab from loaded camera and faces * @throws IllegalArgumentException if the project has not a folder assigned */ public RecoverTasksWorker(Project project, ProgressDialog progressDialog, BiConsumer<Camera, FacesProxy> consumer) { public RecoverTasksWorker(Project project, ProgressDialog<Boolean, Integer> progressDialog, BiConsumer<Camera, FacesProxy> consumer) { if (!project.hasProjectDir()) { throw new IllegalArgumentException("project"); } Loading @@ -43,9 +45,7 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { protected Boolean doInBackground() throws Exception { File projectDir = new File(project.getProjectDir().toString()); File[] files = projectDir.listFiles((dir, name) -> { return name.toLowerCase().endsWith(".bin"); }); File[] files = projectDir.listFiles((dir, name) -> name.toLowerCase().endsWith(".bin")); int counter = 0; for (File file: files) { Loading @@ -57,6 +57,9 @@ public class RecoverTasksWorker extends SwingWorker<Boolean, Integer> { Camera camera = (Camera) in.readObject(); FacesProxy faces = new FacesProxy(in); this.consumer.accept(camera, faces); } catch (Exception ex) { Logger.print("[ERROR] Task recovery: " + ex); throw ex; } int progress = (int)Math.round(100.0 * ++counter / files.length); Loading
HumanFace/src/main/java/cz/fidentis/analyst/face/HumanFace.java +13 −17 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import cz.fidentis.analyst.Logger; import cz.fidentis.analyst.distance.kdtree.KdTreeApproxDistanceToTriangles; import cz.fidentis.analyst.events.HumanFaceEvent; import cz.fidentis.analyst.events.HumanFaceListener; import cz.fidentis.analyst.shapes.Box; import cz.fidentis.analyst.feature.FeaturePoint; import cz.fidentis.analyst.feature.FeaturePointType.FeaturePointCategory; import cz.fidentis.analyst.feature.RelationToMesh; Loading @@ -16,6 +15,7 @@ import cz.fidentis.analyst.mesh.CurvatureCalculator; import cz.fidentis.analyst.mesh.core.MeshModel; import cz.fidentis.analyst.mesh.io.MeshObjLoader; import cz.fidentis.analyst.octree.Octree; import cz.fidentis.analyst.shapes.Box; import cz.fidentis.analyst.shapes.Plane; import cz.fidentis.analyst.shapes.SurfaceMask; Loading @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; /** * A human face instance. Loading @@ -45,6 +44,8 @@ import java.util.stream.Collectors; */ public class HumanFace implements Serializable { public static final String LANDMARK_FILE_SUFFIX = "_landmarks.csv"; private MeshModel meshModel; /** Loading @@ -57,7 +58,6 @@ public class HumanFace implements Serializable { private Plane symmetryPlane; //private MeshFacet symmetryPlaneMesh; private Box bbox; private List<FeaturePoint> featurePoints; Loading @@ -68,7 +68,7 @@ public class HumanFace implements Serializable { private boolean hasCurvature = false; private final SurfaceMask surfaceMask = new SurfaceMask(); private final transient SurfaceMask surfaceMask = new SurfaceMask(); /** * Fast (de)serialization handler Loading Loading @@ -170,7 +170,6 @@ public class HumanFace implements Serializable { } this.meshModel = meshModel; updateBoundingBox(); //announceEvent(new MeshChangedEvent(this, getShortName(), this)); } /** Loading Loading @@ -276,6 +275,7 @@ public class HumanFace implements Serializable { /** * * @param points List of feature points * @deprecated */ @Deprecated public void setFeaturePoints(List<FeaturePoint> points) { Loading @@ -302,7 +302,6 @@ public class HumanFace implements Serializable { if (featurePoints == null) { return Collections.emptyList(); } //return Collections.unmodifiableList(featurePoints); return featurePoints; } Loading @@ -312,7 +311,7 @@ public class HumanFace implements Serializable { public List<FeaturePoint> getStandardFeaturePoints() { return getFeaturePoints().stream() .filter(fp -> fp.getFeaturePointType().getCategory() == FeaturePointCategory.STANDARD) .collect(Collectors.toList()); .toList(); } /** Loading @@ -321,7 +320,7 @@ public class HumanFace implements Serializable { public List<FeaturePoint> getCustomFeaturePoints() { return getFeaturePoints().stream() .filter(fp -> fp.getFeaturePointType().getCategory() == FeaturePointCategory.CUSTOM) .collect(Collectors.toList()); .toList(); } /** Loading Loading @@ -453,17 +452,17 @@ public class HumanFace implements Serializable { * @return The file with landmarks or {@code null} */ public final File findLandmarks() { String filename = getId().split(".obj")[0] + "_landmarks.csv"; String filename = getId().split(".obj")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } filename = getId().split("_ECA")[0] + "_landmarks.csv"; filename = getId().split("_ECA")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } filename = getId().split("_CA")[0] + "_landmarks.csv"; filename = getId().split("_CA")[0] + LANDMARK_FILE_SUFFIX; if ((new File(filename)).exists()) { return new File(filename); } Loading Loading @@ -497,9 +496,9 @@ public class HumanFace implements Serializable { * @return relation */ protected RelationToMesh computeFeaturePointRelation(FeaturePoint featurePoint) { KdTree kdTree = computeKdTree(false); KdTree tmpKdTree = computeKdTree(false); KdTreeApproxDistanceToTriangles visitor = new KdTreeApproxDistanceToTriangles(featurePoint.getPosition(), true); kdTree.accept(visitor); tmpKdTree.accept(visitor); return new RelationToMesh(visitor.getDistance(), visitor.getNearestPoints()); } Loading @@ -521,10 +520,7 @@ public class HumanFace implements Serializable { return false; } final HumanFace other = (HumanFace) obj; if (!Objects.equals(this.id, other.id)) { return false; } return true; return Objects.equals(this.id, other.id); } Loading