Class MasksCorrespondence
java.lang.Object
cz.fidentis.analyst.data.surfacemask.MasksCorrespondence
A class that manages the correspondence between 3D surface masks and their 2D representations.
This class allows mapping a 3D
SurfaceMask
to a SurfaceMask2D
representation.
It provides methods to add mappings, retrieve a 2D mask for a given 3D mask, and clear all mappings.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new MasksCorrespondence object with an empty mapping list. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Triggers the action listener previously set with the associated action event.void
addCorrespondence
(SurfaceMask mask3d, SurfaceMask boundingMask, SurfaceMask2D mask2d, Layer layer) Adds a correspondence mapping between a 3D surface mask and a 2D surface mask.void
clear()
Clears all mask correspondences and resets the mapping list.get2dMask
(SurfaceMask mask3d) Retrieves the 2D surface mask corresponding to a given 3D mask.double
getEllipse
(SurfaceMask mask3d) Retrieves the ellipse-shaped 3D surface mask associated with a given bounding mask.int
int
double
void
setActionListenerAndEvent
(ActionListener actionListener, ActionEvent actionEvent) Sets an action listener and action event to be used for callbacks.void
setPanelProperties
(int panelWidth, int panelHeight, double bBoxScale, double zoomPercentage) Sets panel properties that affect how masks are rendered or interpreted in 2D space.void
update2DMask
(SurfaceMask2D oldMask, SurfaceMask2D newMask) Updates the 2D mask in the mapping, replacing an old mask with a new oneSurfaceMaskLine
.
-
Constructor Details
-
MasksCorrespondence
public MasksCorrespondence()Constructs a new MasksCorrespondence object with an empty mapping list.
-
-
Method Details
-
addCorrespondence
public void addCorrespondence(SurfaceMask mask3d, SurfaceMask boundingMask, SurfaceMask2D mask2d, Layer layer) Adds a correspondence mapping between a 3D surface mask and a 2D surface mask.- Parameters:
mask3d
- The 3D mask.boundingMask
- Bounding maskmask2d
- The corresponding 2D surface mask.layer
- The layer associated with the mask (used for mask layering purposes).
-
get2dMask
Retrieves the 2D surface mask corresponding to a given 3D mask.- Parameters:
mask3d
- The 3D surface mask for which to find the 2D representation.- Returns:
- The corresponding 2D surface mask, or
null
if not found.
-
getEllipse
Retrieves the ellipse-shaped 3D surface mask associated with a given bounding mask. This method searches for a mapping where the specified 3D mask is used as a bounding mask and returns the corresponding ellipse-shaped surface mask.- Parameters:
mask3d
- The 3D surface mask serving as the bounding mask.- Returns:
- The associated ellipse-shaped surface mask, or
null
if not found.
-
update2DMask
Updates the 2D mask in the mapping, replacing an old mask with a new oneSurfaceMaskLine
. Updates the associated layer with the new mask and sets it as the current mask.- Parameters:
oldMask
- The existing 2D surface mask to replace.newMask
- The new 2D surface mask.
-
clear
public void clear()Clears all mask correspondences and resets the mapping list. -
setPanelProperties
public void setPanelProperties(int panelWidth, int panelHeight, double bBoxScale, double zoomPercentage) Sets panel properties that affect how masks are rendered or interpreted in 2D space.- Parameters:
panelWidth
- Width of the panel in pixels.panelHeight
- Height of the panel in pixels.bBoxScale
- Bounding box scale factor.zoomPercentage
- Zoom level as a percentage.
-
getPanelWidth
public int getPanelWidth()- Returns:
- The panel width.
-
getPanelHeight
public int getPanelHeight()- Returns:
- The panel height.
-
getBBoxScale
public double getBBoxScale()- Returns:
- The bounding box scale factor.
-
getZoomPercentage
public double getZoomPercentage()- Returns:
- The zoom percentage for the panel view.
-
setActionListenerAndEvent
Sets an action listener and action event to be used for callbacks. Used for triggering UI updates when correspondence changes.- Parameters:
actionListener
- The action listener to trigger.actionEvent
- The event to pass to the listener.
-
actionPerformedWithEvent
public void actionPerformedWithEvent()Triggers the action listener previously set with the associated action event. Used to notify listeners that correspondence data has changed.
-