Class JDialogMultiPaint

  • All Implemented Interfaces:
    DialogDefaultsInterface, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class JDialogMultiPaint
    extends JDialogBase
    implements java.awt.event.MouseListener, java.awt.event.KeyListener
    .

    Dialog box for the advanced paint power tools: morphology operations, object delete, etc. Bring up this dialog from the normal power paint dialog.

    Version:
    May 2005
    Author:
    Pierre-Louis Bazin
    See Also:
    JDialogBase, AlgorithmInterface, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JDialog

        javax.swing.JDialog.AccessibleJDialog
      • Nested classes/interfaces inherited from class java.awt.Dialog

        java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Processes the events from this dialog's buttons.
      void addIntensityLock​(int intensity)
      Adds an Integer object to the intensityLockVector.
      private void autosaveMask()  
      private void buildLoadDialog()
      Instantiates and shows the "Load label file" dialog, which is used to load a text file containing the names of the colored labels.
      private void buildSaveDialog()
      Instantiates and shows the "Save label file" dialog, which is used to save a text file containing the names of the colored labels.
      private void commitPaintToMask​(int num)
      Converts the paint to a mask.
      int countMaskLabels()
      Procedure that counts the number of labels in the mask image.
      private void deselectMask()
      Sets buttons to deselected, then calls refreshImagePaint to reset paint as mask.
      int getActiveMask()  
      private java.util.TreeSet<java.lang.Integer> getMaskTreeSet​(ModelImage imgB)
      Determines the intensities of image B.....populates the treeset and returns it.
      void imageBInit()
      DOCUMENT ME!
      private void init()
      Initializes the GUI (panels, buttons, etc) and displays it on the screen.
      private void initBlankPaint​(int num)
      Initializes a new blank paint mask to the color indexed by the parameter 'num'
      void keyPressed​(java.awt.event.KeyEvent e)
      Handle the key pressed event.
      void keyReleased​(java.awt.event.KeyEvent e)
      Handle the key released event.
      void keyTyped​(java.awt.event.KeyEvent e)
      Handle the key typed event.
      private void loadFileActionPerformed​(java.awt.event.ActionEvent evt)
      Handles the action event generated by the "Load label file" dialog.
      private void lockAll()
      locks all masks
      void mouseClicked​(java.awt.event.MouseEvent e)
      DOCUMENT ME!
      void mouseEntered​(java.awt.event.MouseEvent e)
      DOCUMENT ME!
      void mouseExited​(java.awt.event.MouseEvent e)
      DOCUMENT ME!
      void mousePressed​(java.awt.event.MouseEvent e)
      DOCUMENT ME!
      void mouseReleased​(java.awt.event.MouseEvent e)
      DOCUMENT ME!
      private void newLabelList​(int Nbx, int Nby)
      Purpose: unknown.
      void readLabelsFromFile​(java.lang.String filename)
      Reads the 'labels' file from disk.
      private void refreshImagePaint​(ModelImage img)
      Refreshes the displayed paint mask.
      private void refreshImagePaint​(ModelImage img, java.util.BitSet obj)
      Refreshes the displayed paint mask.
      private void refreshLabelDisplay()
      Reinstantiates the labels for redisplay.
      void removeIntensityLock​(int intensity)
      Removes an intensity value from the intensityLockVector.
      private void resetLabelList​(int Nbx, int Nby)
      Used to reset the button labels to their default setting.
      private void saveFileActionPerformed​(java.awt.event.ActionEvent evt)
      Handles the action event generated by the "Save label file" dialog.
      private void selectedMaskToPaint​(int num)
      Converts the selected mask to paint.
      private void switchPaintAndMask​(int from, int to, int colorNum)
      Converts paint to a mask, then mask to paint.
      private void unlockAll()
      unlocks all masks
      void windowClosing​(java.awt.event.WindowEvent event)
      windowclosing...override of WindowListener interface.
      private void writeLabelsToFile​(java.lang.String filename)
      Writes the 'labels' file to disk.
      • Methods inherited from class javax.swing.JDialog

        addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Dialog

        addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • lutB

        private static ModelLUT lutB
        DOCUMENT ME!
      • alphaBlend

        private int alphaBlend
        DOCUMENT ME!
      • triPlanarAlphaBlend

        private int triPlanarAlphaBlend
        DOCUMENT ME!
      • bottomPanel

        private javax.swing.JPanel bottomPanel
        DOCUMENT ME!
      • closePanel

        private javax.swing.JPanel closePanel
        DOCUMENT ME!
      • buttonShortkeys

        private javax.swing.JToggleButton buttonShortkeys
        DOCUMENT ME!
      • buttonTextArrayList

        private java.util.ArrayList<java.lang.Integer> buttonTextArrayList
        this is the array list of texts for the mask number buttons.
      • collapseButton

        private javax.swing.JButton collapseButton
        Button that allows user to collapse masks/paint to single value.*
      • saveAs3DMaskRadio

        private javax.swing.JRadioButton saveAs3DMaskRadio
        radio buttons for commmiting masks as 3d or 4d if image is 4d
      • saveAs4DMaskRadio

        private javax.swing.JRadioButton saveAs4DMaskRadio
        radio buttons for commmiting masks as 3d or 4d if image is 4d
      • radioGroup

        private javax.swing.ButtonGroup radioGroup
        button group for radio buttons
      • saveMasksAs4D

        private boolean saveMasksAs4D
        this boolean is needed for commiting masks for a 4d image
      • color

        private java.awt.Color[] color
        array of colors to use for the labels.
      • currentOpacity

        private float currentOpacity
        saved opacity parameter when hiding the paint
      • displayMasksButton

        private javax.swing.JToggleButton displayMasksButton
        display masks toggle button.
      • displayModeButton

        private javax.swing.JToggleButton displayModeButton
        DOCUMENT ME!
      • displayPaintButton

        private javax.swing.JToggleButton displayPaintButton
        DOCUMENT ME!
      • editBox

        private javax.swing.JCheckBox editBox
        DOCUMENT ME!
      • exportVoiButton

        private javax.swing.JButton exportVoiButton
        button VOI export.
      • imgBSize

        private int imgBSize
        The size, in voxels, of the mask.
      • importVoiButton

        private javax.swing.JButton importVoiButton
        button VOI import.
      • indeterminateProgressBar

        private javax.swing.JProgressBar indeterminateProgressBar
        DOCUMENT ME!
      • intensityLockVector

        private java.util.Vector<java.lang.Integer> intensityLockVector
        DOCUMENT ME!
      • label

        private java.lang.String[] label
        labels for the painted objects.
      • labelField

        private javax.swing.JTextField[] labelField
        DOCUMENT ME!
      • listPanel

        private javax.swing.JPanel listPanel
        DOCUMENT ME!
      • loadDialog

        private javax.swing.JFileChooser loadDialog
        DOCUMENT ME!
      • loadLabelsButton

        private javax.swing.JButton loadLabelsButton
        DOCUMENT ME!
      • loadMaskButton

        private javax.swing.JButton loadMaskButton
        DOCUMENT ME!
      • checkAutosave

        private javax.swing.JToggleButton checkAutosave
      • saver

        private java.util.Timer saver
        DOCUMENT ME!
      • mainPanel

        private javax.swing.JPanel mainPanel
        dialog elements.
      • multiPanel

        private javax.swing.JPanel multiPanel
        DOCUMENT ME!
      • nbx

        private int nbx
        number of paint masks initially.
      • nby

        private int nby
        number of paint masks initially.
      • newSelection

        private int newSelection
        This represents the button the user selects to..initally at 1.*
      • numberLabel

        private javax.swing.JLabel numberLabel
        DOCUMENT ME!
      • numberPanel

        private javax.swing.JPanel numberPanel
        DOCUMENT ME!
      • numberXField

        private javax.swing.JTextField numberXField
        resize x value.
      • numberYField

        private javax.swing.JTextField numberYField
        resize y value.
      • optionPanel

        private javax.swing.JPanel optionPanel
        DOCUMENT ME!
      • preserveBox

        private javax.swing.JCheckBox[] preserveBox
        DOCUMENT ME!
      • preserved

        private boolean[] preserved
        check whether the mask can be affected by new paint or not.
      • resizeButton

        private javax.swing.JButton resizeButton
        resize button.
      • saveDialog

        private javax.swing.JFileChooser saveDialog
        DOCUMENT ME!
      • saveLabelsButton

        private javax.swing.JButton saveLabelsButton
        save labels button.
      • saveMaskButton

        private javax.swing.JButton saveMaskButton
        save mask button.
      • scrollPane

        private javax.swing.JScrollPane scrollPane
        This is the scroll pane for the label list panel.*
      • selected

        private int selected
        id for the selected paint mask.
      • leftPanel

        private javax.swing.JPanel leftPanel
        DOCUMENT ME!
      • rightPanel

        private javax.swing.JPanel rightPanel
        DOCUMENT ME!
      • leftRightPanel

        private javax.swing.JPanel leftRightPanel
        DOCUMENT ME!
      • lockAllButton

        private javax.swing.JButton lockAllButton
        lock all masks checkbox *
      • unlockAllButton

        private javax.swing.JButton unlockAllButton
        unlock all masks checkbox *
      • lockPanel

        private javax.swing.JPanel lockPanel
        lock panel
      • isVisibleMask

        private boolean isVisibleMask
      • isVisiblePaint

        private boolean isVisiblePaint
      • isCompactDisplay

        private boolean isCompactDisplay
      • threads

        private java.lang.ThreadGroup threads
    • Constructor Detail

      • JDialogMultiPaint

        public JDialogMultiPaint​(ModelImage im)
        Used primarily for the script to store variables and run the algorithm. No actual dialog will appear but the set up info and result image will be stored here.
        Parameters:
        im - Source image.
      • JDialogMultiPaint

        public JDialogMultiPaint​(java.awt.Frame theParentFrame,
                                 ModelImage im)
        Creates dialog for plugin.
        Parameters:
        theParentFrame - Parent frame.
        im - Source image.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Processes the events from this dialog's buttons.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class JDialogBase
        Parameters:
        event - Event that triggers the action.
      • addIntensityLock

        public void addIntensityLock​(int intensity)
        Adds an Integer object to the intensityLockVector. The Integer object represents an intensity value which is locked - that is, cannot be overwritten by a "Paint to mask" operation.
        Parameters:
        intensity - the intensity value to lock
      • countMaskLabels

        public int countMaskLabels()
        Procedure that counts the number of labels in the mask image.
        Returns:
        DOCUMENT ME!
      • getActiveMask

        public final int getActiveMask()
      • imageBInit

        public void imageBInit()
        DOCUMENT ME!
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Handle the key pressed event.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
        Parameters:
        e - DOCUMENT ME!
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Handle the key released event.
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Parameters:
        e - DOCUMENT ME!
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Handle the key typed event.
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
        Parameters:
        e - DOCUMENT ME!
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        DOCUMENT ME!
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        e - DOCUMENT ME!
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        DOCUMENT ME!
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        e - DOCUMENT ME!
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        DOCUMENT ME!
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        e - DOCUMENT ME!
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        DOCUMENT ME!
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        e - DOCUMENT ME!
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        DOCUMENT ME!
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        e - DOCUMENT ME!
      • readLabelsFromFile

        public void readLabelsFromFile​(java.lang.String filename)
        Reads the 'labels' file from disk.
        Parameters:
        filename - DOCUMENT ME!
      • removeIntensityLock

        public void removeIntensityLock​(int intensity)
        Removes an intensity value from the intensityLockVector.
        Parameters:
        intensity - the intensity value to remove
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent event)
        windowclosing...override of WindowListener interface.
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
        Overrides:
        windowClosing in class JDialogBase
        Parameters:
        event - DOCUMENT ME!
      • buildLoadDialog

        private void buildLoadDialog()
        Instantiates and shows the "Load label file" dialog, which is used to load a text file containing the names of the colored labels.
      • buildSaveDialog

        private void buildSaveDialog()
        Instantiates and shows the "Save label file" dialog, which is used to save a text file containing the names of the colored labels.
      • commitPaintToMask

        private void commitPaintToMask​(int num)
        Converts the paint to a mask. Creates a new mask image if one does not already exist.
        Parameters:
        num - the index into the color array, which indicates the color of the paint
      • deselectMask

        private void deselectMask()
        Sets buttons to deselected, then calls refreshImagePaint to reset paint as mask.
      • getMaskTreeSet

        private java.util.TreeSet<java.lang.Integer> getMaskTreeSet​(ModelImage imgB)
        Determines the intensities of image B.....populates the treeset and returns it.
        Parameters:
        imgB - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • init

        private void init()
        Initializes the GUI (panels, buttons, etc) and displays it on the screen.
      • lockAll

        private void lockAll()
        locks all masks
      • unlockAll

        private void unlockAll()
        unlocks all masks
      • initBlankPaint

        private void initBlankPaint​(int num)
        Initializes a new blank paint mask to the color indexed by the parameter 'num'
        Parameters:
        num - the index into the color array
      • loadFileActionPerformed

        private void loadFileActionPerformed​(java.awt.event.ActionEvent evt)
        Handles the action event generated by the "Load label file" dialog. Calls readLabelsFromFile(String) to read the label file selected by the user.
        Parameters:
        evt - the ActionEvent generated by this dialog
      • newLabelList

        private void newLabelList​(int Nbx,
                                  int Nby)
        Purpose: unknown.
        Parameters:
        Nbx - number of labels in the x-direction
        Nby - number of labels in the y-direction
      • refreshImagePaint

        private void refreshImagePaint​(ModelImage img,
                                       java.util.BitSet obj)
        Refreshes the displayed paint mask.
        Parameters:
        img - DOCUMENT ME!
        obj - DOCUMENT ME!
      • refreshImagePaint

        private void refreshImagePaint​(ModelImage img)
        Refreshes the displayed paint mask.
        Parameters:
        img - DOCUMENT ME!
      • refreshLabelDisplay

        private void refreshLabelDisplay()
        Reinstantiates the labels for redisplay. Purpose: unknown
      • resetLabelList

        private void resetLabelList​(int Nbx,
                                    int Nby)
        Used to reset the button labels to their default setting. Currently not used.
        Parameters:
        Nbx - number of labels in the x-direction
        Nby - number of labels in the y-direction
      • saveFileActionPerformed

        private void saveFileActionPerformed​(java.awt.event.ActionEvent evt)
        Handles the action event generated by the "Save label file" dialog. Calls readLabelsFromFile(String) to save the labels to the file selected by the user.
        Parameters:
        evt - the ActionEvent generated by this dialog
      • selectedMaskToPaint

        private void selectedMaskToPaint​(int num)
        Converts the selected mask to paint.
        Parameters:
        num - the index into the color array, which indicates the color of the paint
      • switchPaintAndMask

        private void switchPaintAndMask​(int from,
                                        int to,
                                        int colorNum)
        Converts paint to a mask, then mask to paint. Reason: unknown.
        Parameters:
        from - DOCUMENT ME!
        to - DOCUMENT ME!
      • writeLabelsToFile

        private void writeLabelsToFile​(java.lang.String filename)
        Writes the 'labels' file to disk.
        Parameters:
        filename - DOCUMENT ME!
      • autosaveMask

        private final void autosaveMask()