Class SegmentationPanel

    • Field Detail

      • ZOOM_FACTOR

        public static final double ZOOM_FACTOR
        the zoom factor to use.
        See Also:
        Constant Field Values
      • m_Manager

        protected LayerManager m_Manager
        layer manager.
      • m_TextZoom

        protected NumberTextField m_TextZoom
        the text field for the zoom.
      • m_ButtonZoomClear

        protected BaseFlatButton m_ButtonZoomClear
        the button for clearing zoom.
      • m_ButtonZoomIn

        protected BaseFlatButton m_ButtonZoomIn
        the button for zooming in.
      • m_ButtonZoomOut

        protected BaseFlatButton m_ButtonZoomOut
        the button for zooming out.
      • m_ButtonZoomBestFit

        protected BaseFlatButton m_ButtonZoomBestFit
        the button for best fit zoom.
      • m_ButtonZoom

        protected BaseFlatButton m_ButtonZoom
        the button for applying the zoom.
      • m_ButtonAddUndo

        protected BaseFlatButton m_ButtonAddUndo
        the button for adding an undo.
      • m_ButtonUndo

        protected BaseFlatButton m_ButtonUndo
        the button for performing an undo.
      • m_ButtonRedo

        protected BaseFlatButton m_ButtonRedo
        the button for performing a redo.
      • m_SplitPaneLeft

        protected BaseSplitPane m_SplitPaneLeft
        the main split pane.
      • m_SplitPaneRight

        protected BaseSplitPane m_SplitPaneRight
        the left split pane.
      • m_PanelLeft

        protected BasePanel m_PanelLeft
        the left panel.
      • m_PanelLayers

        protected BasePanel m_PanelLayers
        the layers panel.
      • m_ButtonLayersAll

        protected BaseButton m_ButtonLayersAll
        the buttons for enabling all layers.
      • m_ButtonLayersNone

        protected BaseButton m_ButtonLayersNone
        the buttons for disabling all layers.
      • m_ButtonLayersInvert

        protected BaseButton m_ButtonLayersInvert
        the buttons for inverting selected layers.
      • m_PanelTools

        protected BasePanel m_PanelTools
        the tools panel.
      • m_Tools

        protected List<Tool> m_Tools
        the tools.
      • m_SplitPaneTools

        protected BaseSplitPane m_SplitPaneTools
        the split pane for the tools.
      • m_PanelToolOptions

        protected BasePanel m_PanelToolOptions
        the panel for displaying the tool options.
      • m_PanelCenter

        protected BasePanel m_PanelCenter
        the center panel.
      • m_ScrollPane

        protected BaseScrollPane m_ScrollPane
        the JScrollPane that embeds the canvas panel.
      • m_PanelCanvas

        protected CanvasPanel m_PanelCanvas
        the panel for drawing.
      • m_LastMouseListener

        protected MouseListener m_LastMouseListener
        the last mouse listener in use.
      • m_LastMouseMotionListener

        protected MouseMotionListener m_LastMouseMotionListener
        the last mouse motion listener in use.
      • m_LastKeyListener

        protected KeyListener m_LastKeyListener
        the last key listener in use.
      • m_PaintOperation

        protected PaintOperation m_PaintOperation
        the paint operation in use.
      • m_ActiveTool

        protected Tool m_ActiveTool
        the active tool.
      • m_PanelToolButtons

        protected JPanel m_PanelToolButtons
        the panel with the buttons.
    • Constructor Detail

      • SegmentationPanel

        public SegmentationPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finishes the initialization.
        Overrides:
        finishInit in class BasePanel
      • getManager

        public LayerManager getManager()
        Returns the layer manager.
        Returns:
        the manager
      • getPaintOperation

        public PaintOperation getPaintOperation()
        Returns the paint operation.
        Returns:
        the operation
      • getScrollPane

        public BaseScrollPane getScrollPane()
        Returns the scrollpane.
        Returns:
        the scroll pane
      • stateChanged

        public void stateChanged​(ChangeEvent e)
        Gets called when the layers have changed somehow.
        Specified by:
        stateChanged in interface ChangeListener
        Parameters:
        e - the event
      • updateButtons

        protected void updateButtons()
        Updates the state of the buttons.
      • updateLayerInfo

        protected void updateLayerInfo()
        Updates information about layers.
      • getUndo

        public Undo getUndo()
        Returns the underlying undo handler.
        Returns:
        the Undo
      • addUndoPoint

        public void addUndoPoint()
        Adds an undo point.
      • undo

        public void undo()
        Performs an undo.
      • redo

        public void redo()
        Performs a redo.
      • undoOccurred

        public void undoOccurred​(UndoEvent e)
        An undo event, like add or remove, has occurred.
        Specified by:
        undoOccurred in interface UndoListener
        Parameters:
        e - the trigger event
      • notifyTools

        protected void notifyTools()
        Notifies the tools that annotations have changed.
      • update

        public void update()
        Updates buttons and manager.
      • setZoom

        public void setZoom​(double value)
        Sets the zoom to use.
        Parameters:
        value - the zoom (100 = original size)
      • getZoom

        public double getZoom()
        Returns the current zoom in use.
        Returns:
        the zoom (100 = original size)
      • clearZoom

        public void clearZoom()
        Clears the zoom.
      • zoomIn

        public void zoomIn()
        Zooms in.
      • zoomOut

        public void zoomOut()
        Zooms out.
      • bestFitZoom

        public void bestFitZoom()
        Fits the image.
      • setLeftDividerLocation

        public void setLeftDividerLocation​(int value)
        Sets the location of the left divider.
        Parameters:
        value - the position in pixels
      • setLeftDividerLocation

        public void setLeftDividerLocation​(double value)
        Sets the proportional location for the left divider.
        Parameters:
        value - the location (0-1)
      • getLeftDividerLocation

        public int getLeftDividerLocation()
        Returns the left divider location.
        Returns:
        the position in pixels
      • setRightDividerLocation

        public void setRightDividerLocation​(int value)
        Sets the location of the right divider.
        Parameters:
        value - the position in pixels
      • setRightDividerLocation

        public void setRightDividerLocation​(double value)
        Sets the proportional location for the right divider.
        Parameters:
        value - the location (0-1)
      • getRightDividerLocation

        public int getRightDividerLocation()
        Returns the right divider location.
        Returns:
        the position in pixels
      • setToolButtonColumns

        public void setToolButtonColumns​(int columns)
        Sets the number of columns used for the tool buttons.
        Parameters:
        columns - the columns
      • getToolButtonColumns

        public int getToolButtonColumns()
        Returns the number of columns used for the tool buttons.
        Returns:
        the columns
      • setAutomaticUndoEnabled

        public void setAutomaticUndoEnabled​(boolean value)
        Sets whether automatic undos are enabled.
        Parameters:
        value - true if enabled
      • isAutomaticUndoEnabled

        public boolean isAutomaticUndoEnabled()
        Returns whether automatic undos are enabled.
        Returns:
        true if enabled
      • fromContainer

        public void fromContainer​(ImageSegmentationContainer segcont,
                                  String[] labels,
                                  boolean useSeparateLayers,
                                  ColorProvider colorProvider,
                                  float alpha,
                                  boolean allowLayerRemoval,
                                  boolean allowLayerActions,
                                  SegmentationPanel.LayerVisibility layerVisibility,
                                  List<AbstractLayer.AbstractLayerState> lastSettings,
                                  LoggingObject logger)
        Retrieves the layers from the container.
        Parameters:
        segcont - the container to use
        labels - the labels to use
        useSeparateLayers - whether to use separate layers or combined layers
        colorProvider - for generating the colors for the layers, will be reset in this method
        alpha - the default alpha value to use
        allowLayerRemoval - whether layers can be removed
        allowLayerActions - whether actions are allowed
        layerVisibility - the visibility to use
        lastSettings - the previous settings, can be null
        logger - the logging object to use, can be null
      • toContainer

        public ImageSegmentationContainer toContainer()
        Turns the layers into a container. Uses any previously set value whether separate layers were used.
        Returns:
        the generated container
        See Also:
        m_ContainerSettings
      • toContainer

        public ImageSegmentationContainer toContainer​(boolean useSeparateLayers)
        Turns the layers into a container.
        Parameters:
        useSeparateLayers - whether to use separate layers or combined layers
        Returns:
        the generated container
      • getCanvasPanel

        public CanvasPanel getCanvasPanel()
        Returns the underlying canvas panel.
        Returns:
        the canvas
      • setToolPanelVisible

        public void setToolPanelVisible​(boolean value)
        Hides or shows the tools panel.
        Parameters:
        value - true if to show
      • isToolPanelVisible

        public boolean isToolPanelVisible()
        Returns whether the tools panel is visible.
        Returns:
        true if visible
      • getActiveTool

        public Tool getActiveTool()
        Returns the currently active tool.
        Returns:
        the active tool, null if not available
      • overlayTest

        protected static SegmentationPanel overlayTest​(String[] args)
        Generates a panel with separate overlay layers.
        Parameters:
        args - the files to load
        Returns:
        the panel
      • combinedTest

        protected static SegmentationPanel combinedTest​(String[] args)
        Generates a panel with a combined layer.
        Parameters:
        args - the files to load
        Returns:
        the panel
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler
      • main

        public static void main​(String[] args)
        For testing only.
        Parameters:
        args - the files to load