Commit d5df3fbc authored by Radim Jurčaga's avatar Radim Jurčaga Committed by Radek Ošlejšek
Browse files

Update mask terminology

parent ddff9231
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ import cz.fidentis.analyst.data.ray.Ray;
import cz.fidentis.analyst.data.shapes.Box;
import cz.fidentis.analyst.data.shapes.Glyph;
import cz.fidentis.analyst.data.shapes.Plane;
import cz.fidentis.analyst.data.surfacemask.SurfaceMask;
import cz.fidentis.analyst.data.surfacemask.Mask3DProjection;

import java.io.Serializable;
import java.util.List;
@@ -140,7 +140,7 @@ public interface HumanFace extends Serializable {
     *
     * @return the interactive mask
     */
    SurfaceMask getSurfaceMask();
    Mask3DProjection getMask3DProjection();

    /**
     * Returns a deep copy of current state.
@@ -201,9 +201,9 @@ public interface HumanFace extends Serializable {
    /**
     * Set a surface mask.
     *
     * @param surfaceMask surfaceMask or {@code null}
     * @param mask3DProjection surfaceMask or {@code null}
     */
    void setSurfaceMask(SurfaceMask surfaceMask);
    void setMask3DProjection(Mask3DProjection mask3DProjection);

    /**
     * Gets face frontal direction.
+7 −7
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import cz.fidentis.analyst.data.ray.Ray;
import cz.fidentis.analyst.data.shapes.Box;
import cz.fidentis.analyst.data.shapes.Glyph;
import cz.fidentis.analyst.data.shapes.Plane;
import cz.fidentis.analyst.data.surfacemask.SurfaceMask;
import cz.fidentis.analyst.data.surfacemask.Mask3DProjection;
import org.slf4j.Logger;

import java.io.File;
@@ -61,7 +61,7 @@ public class HumanFaceImpl implements HumanFace {

    private final boolean isAverageFace;

    private transient SurfaceMask surfaceMask = new SurfaceMask();
    private transient Mask3DProjection mask3DProjection = new Mask3DProjection();

    private List<Glyph> glyphs;

@@ -213,8 +213,8 @@ public class HumanFaceImpl implements HumanFace {
    }

    @Override
    public SurfaceMask getSurfaceMask() {
        return surfaceMask;
    public Mask3DProjection getMask3DProjection() {
        return mask3DProjection;
    }

    @Override
@@ -264,8 +264,8 @@ public class HumanFaceImpl implements HumanFace {
    }

    @Override
    public void setSurfaceMask(SurfaceMask surfaceMask) {
        this.surfaceMask = surfaceMask;
    public void setMask3DProjection(Mask3DProjection mask3DProjection) {
        this.mask3DProjection = mask3DProjection;
    }

    @Override
@@ -293,7 +293,7 @@ public class HumanFaceImpl implements HumanFace {
        result = 31 * result + Objects.hashCode(landmarks);
        result = 31 * result + Objects.hashCode(name);
        result = 31 * result + Boolean.hashCode(isAverageFace);
        result = 31 * result + Objects.hashCode(surfaceMask);
        result = 31 * result + Objects.hashCode(mask3DProjection);
        result = 31 * result + Objects.hashCode(glyphs);
        return result;
    }
+3 −3
Original line number Diff line number Diff line
package cz.fidentis.analyst.engines.face;

import cz.fidentis.analyst.data.face.HumanFace;
import cz.fidentis.analyst.data.surfacemask.SurfaceMask;
import cz.fidentis.analyst.data.surfacemask.SurfaceMaskVariant;
import cz.fidentis.analyst.data.surfacemask.Mask3DProjection;
import cz.fidentis.analyst.data.surfacemask.MaskVariant;
import cz.fidentis.analyst.engines.face.exception.LocalResourceUnavailableException;
import cz.fidentis.analyst.engines.face.exception.RemoteServiceFailedException;
import cz.fidentis.analyst.engines.face.exception.RemoteServiceUnreachableException;
@@ -29,7 +29,7 @@ public class FaceMasksServices {
     * @throws RemoteServiceFailedException if the computational request performed with an error
     * @throws LocalResourceUnavailableException if the preparation of data for the service has failed
     */
    public static List<SurfaceMask> detectFaceMasks(HumanFace face, Set<SurfaceMaskVariant> variants)
    public static List<Mask3DProjection> detectFaceMasks(HumanFace face, Set<MaskVariant> variants)
            throws RemoteServiceUnreachableException, RemoteServiceFailedException, LocalResourceUnavailableException {

        return new FaceMasksServicesImpl().detectFaceMasks(face, variants);
+7 −7
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@ import cz.fidentis.analyst.data.face.HumanFace;
import cz.fidentis.analyst.data.mesh.MeshIO;
import cz.fidentis.analyst.data.mesh.MeshModel;
import cz.fidentis.analyst.data.shapes.Box;
import cz.fidentis.analyst.data.surfacemask.SurfaceMask;
import cz.fidentis.analyst.data.surfacemask.SurfaceMaskVariant;
import cz.fidentis.analyst.data.surfacemask.Mask3DProjection;
import cz.fidentis.analyst.data.surfacemask.MaskVariant;
import cz.fidentis.analyst.engines.face.exception.LocalResourceUnavailableException;
import cz.fidentis.analyst.engines.face.exception.RemoteServiceFailedException;
import cz.fidentis.analyst.engines.face.exception.RemoteServiceUnreachableException;
@@ -42,7 +42,7 @@ public class FaceMasksServicesImpl {
     * @throws RemoteServiceFailedException if the computational request performed with an error
     * @throws LocalResourceUnavailableException if the preparation of data for the service has failed
     */
    public List<SurfaceMask> detectFaceMasks(HumanFace face, Set<SurfaceMaskVariant> variants)
    public List<Mask3DProjection> detectFaceMasks(HumanFace face, Set<MaskVariant> variants)
            throws RemoteServiceUnreachableException, RemoteServiceFailedException, LocalResourceUnavailableException  {

        if (variants.isEmpty()) {
@@ -51,7 +51,7 @@ public class FaceMasksServicesImpl {

        FaceMasksApi api = getFaceMaskDetectorClient();

        List<SurfaceMask> surfaceMasks = new ArrayList<>();
        List<Mask3DProjection> mask3DProjections = new ArrayList<>();

        Box bbox = face.getBoundingBox();
        BoundingBoxMaskProjectorConfig bboxProjectorConfig = new BoundingBoxMaskProjectorConfig(
@@ -75,7 +75,7 @@ public class FaceMasksServicesImpl {
            }

            Set<FaceMaskVariant> variantSet = new HashSet<>();
            for (SurfaceMaskVariant variant : variants) {
            for (MaskVariant variant : variants) {
                switch (variant) {
                    case LEFT_EYE -> variantSet.add(FaceMaskVariant.LEFT_EYE);
                    case RIGHT_EYE -> variantSet.add(FaceMaskVariant.RIGHT_EYE);
@@ -102,7 +102,7 @@ public class FaceMasksServicesImpl {

                BoundingBoxMaskProjector mp = new BoundingBoxMaskProjector(bboxProjectorConfig, points);
                face.getOctree().accept(mp);
                surfaceMasks.add(mp.getResult());
                mask3DProjections.add(mp.getResult());
            }
        } catch (ApiException e) {
            if (e.getCode() == 0) {
@@ -124,7 +124,7 @@ public class FaceMasksServicesImpl {
            }
        }

        return surfaceMasks;
        return mask3DProjections;
    }

    private FaceMasksApi getFaceMaskDetectorClient() throws LocalResourceUnavailableException {
+14 −14
Original line number Diff line number Diff line
package cz.fidentis.analyst.gui.elements;

import cz.fidentis.analyst.data.surfacemask.Layer;
import cz.fidentis.analyst.data.surfacemask.SurfaceMaskLayers;
import cz.fidentis.analyst.data.surfacemask.Mask2DLayer;
import cz.fidentis.analyst.data.surfacemask.Mask2DLayers;

import javax.swing.*;
import java.awt.*;
@@ -17,7 +17,7 @@ import static cz.fidentis.analyst.gui.task.masks.InteractiveMaskPanel.ACTION_PRO
 * Represents a UI panel for managing individual layers in the surface mask editor.
 *
 * <p>This panel provides controls for toggling the visibility of a layer, selecting it,
 * and removing it from the {@link SurfaceMaskLayers} manager. The panel includes:
 * and removing it from the {@link Mask2DLayers} manager. The panel includes:
 *  - A visual representation of the layer.
 *  - A button to show/hide the layer.
 *  - A button to delete the layer.
@@ -31,8 +31,8 @@ public class LayerPanel extends JPanel {

    private final JLabel layerIcon;
    private final JButton showHideButton;
    private final Layer layer;
    private final SurfaceMaskLayers layerManager;
    private final Mask2DLayer mask2DLayer;
    private final Mask2DLayers layerManager;
    private final JPanel container;
    private final SurfaceMaskPanel surfaceMaskPanel;
    private final ActionListener actionListener;
@@ -41,14 +41,14 @@ public class LayerPanel extends JPanel {
     * Creates new form of LayerPanel
     *
     * @param container         The parent container that holds this panel.
     * @param layer             The {@link Layer} associated with this panel.
     * @param layerManager      The {@link SurfaceMaskLayers} manager handling multiple layers.
     * @param mask2DLayer             The {@link Mask2DLayer} associated with this panel.
     * @param layerManager      The {@link Mask2DLayers} manager handling multiple layers.
     * @param surfaceMaskPanel  The panel responsible for rendering the surface masks.
     * @param actionListener    The listener for handling actions related to layers.
     *
     */
    public LayerPanel(JPanel container, Layer layer, SurfaceMaskLayers layerManager, SurfaceMaskPanel surfaceMaskPanel, ActionListener actionListener) {
        this.layer = layer;
    public LayerPanel(JPanel container, Mask2DLayer mask2DLayer, Mask2DLayers layerManager, SurfaceMaskPanel surfaceMaskPanel, ActionListener actionListener) {
        this.mask2DLayer = mask2DLayer;
        this.layerManager = layerManager;
        this.container = container;
        this.surfaceMaskPanel = surfaceMaskPanel;
@@ -125,11 +125,11 @@ public class LayerPanel extends JPanel {
        if (layerIcon.getBackground().equals(Color.GRAY)) {
            layerIcon.setBackground(Color.WHITE);
            showHideButton.setIcon(loadIcon(HIDE));
            layer.setVisibility(false);
            mask2DLayer.setVisibility(false);
        } else {
            layerIcon.setBackground(Color.GRAY);
            showHideButton.setIcon(loadIcon(SHOW));
            layer.setVisibility(true);
            mask2DLayer.setVisibility(true);
        }

        surfaceMaskPanel.setNeedsLayerUpdate(true);
@@ -146,10 +146,10 @@ public class LayerPanel extends JPanel {
        container.remove(this);
        container.revalidate();
        container.repaint();
        if (layerManager.getCurrentLayer() == layer) {
        if (layerManager.getCurrentLayer() == mask2DLayer) {
            layerManager.setCurrentLayer(null);
        }
        layerManager.removeLayer(layer);
        layerManager.removeLayer(mask2DLayer);

        surfaceMaskPanel.setNeedsLayerUpdate(true);
        surfaceMaskPanel.repaint();
@@ -176,7 +176,7 @@ public class LayerPanel extends JPanel {
        }

        setBackground(Color.GREEN);
        layerManager.setCurrentLayer(layer);
        layerManager.setCurrentLayer(mask2DLayer);

        surfaceMaskPanel.setNeedsLayerUpdate(true);
        surfaceMaskPanel.repaint();
Loading