Class ViewControlsImage

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener

    public class ViewControlsImage
    extends javax.swing.JPanel
    implements javax.swing.event.ChangeListener, java.awt.event.ActionListener
    This class builds the control panel used in ViewJFrameImage frames. Toolbars are created and added to the panel and the listener for the toolbars is the image frame. If the image frame is to display two images then alpha blending tools are added and displayed.
    Version:
    0.1 Dec 15, 1998 update 9 august 2001
    Author:
    Matthew J. McAuliffe, Ph.D.
    See Also:
    Serialized Form
    • Nested Class Summary

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

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.JSlider alphaSlider
      DOCUMENT ME!
      protected javax.swing.border.TitledBorder borderActiveImage
      DOCUMENT ME!
      protected javax.swing.border.TitledBorder borderImageSlider
      DOCUMENT ME!
      protected ViewJFrameBase frame
      DOCUMENT ME!
      protected java.awt.GridBagConstraints gbc
      DOCUMENT ME!
      protected javax.swing.JPanel generalPanel
      DOCUMENT ME!
      protected javax.swing.ButtonGroup group1
      DOCUMENT ME!
      protected int imageSize
      DOCUMENT ME!
      protected javax.swing.JToolBar paintToolBar
      Paint toolbar.
      protected javax.swing.JPanel panelActiveImage
      DOCUMENT ME!
      protected javax.swing.JPanel panelImageSlider
      DOCUMENT ME!
      protected javax.swing.JPanel panelOptionToolbars
      DOCUMENT ME!
      protected javax.swing.JPanel panelToolbars
      DOCUMENT ME!
      protected javax.swing.JRadioButton radioImageA
      DOCUMENT ME!
      protected javax.swing.JRadioButton radioImageB
      DOCUMENT ME!
      protected javax.swing.JToolBar registrationToolBar
      Registration toolbar.
      protected javax.swing.JToolBar scriptToolBar
      DOCUMENT ME!
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      protected ViewJSlider tImageSlider
      tImageSlider
      protected javax.swing.JToolBar toolBar
      Main toolbar .
      protected ViewToolBarBuilder toolBarObj
      Object builds and controls the toolbars.
      protected ViewJSlider zImageSlider
      DOCUMENT ME!
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Action event handler.
      void add​(java.awt.Component c, java.awt.GridBagConstraints gbc, int x, int y, int w, int h)
      Adds a component to the toolbar panel using the given gridbag constraints.
      void addActiveImageControl()
      Displays the panel which controls which image is the "active image" displayed when imageB is available.
      void addCustomToolBar​(java.util.Vector<CustomUIBuilder.UIParams> paramVector)  
      protected void buildAlphaSlider()
      Builds the slider used to control the alpha blending.
      void buildSimpleToolBar()
      Creates the main toolbar without any of the pre-made additional bars (no VOI etc) for use with addCustomToolBar() to add custom-built bars to the main bar
      void buildToolbar​(boolean showImage, javax.swing.JToolBar voiToolbar, javax.swing.ButtonGroup VOIGroup, javax.swing.JToggleButton VOIPointer, boolean showPaint)
      DOCUMENT ME!
      void buildToolbar​(boolean showImage, javax.swing.JToolBar voiToolbar, javax.swing.ButtonGroup VOIGroup, javax.swing.JToggleButton VOIPointer, boolean showPaint, boolean showScripting)
      Builds the toolbars.
      void finalize()
      Clean up memory.
      int getActiveImage()
      Identifies which image is active.
      ViewJFrameBase getFrame()
      Accessor for the ViewJFrameBase used.
      javax.swing.JSlider getTImageSlider()  
      ViewToolBarBuilder getTools()
      Accessor for the tool bar held by these controls.
      javax.swing.JSlider getZImageSlider()  
      void removeActiveImageControl()
      Removes the controls to the display of which image is "active" in the frame when imageB is not available.
      void runCurrentScript()
      Invokes the toolbar builder to run the currently selected script.
      void setActiveImage​(int image)
      Sets the active image to either A or B and updates the paint spinner values.
      void setAlphaSlider​(int i)  
      void setAlphaSliderEnabled​(boolean enabled)
      DOCUMENT ME!
      void setRecording​(boolean isRecording)
      Used to set the state for the script recorder.
      void setTimeSl​(int slice)
      Directs the image to display a particular time slice.
      void setTSlider​(int tSlice)
      Places the pointer on the (time) slider bar to a location corresponding to the given slice value (within the set).
      void setVOIColor​(int voiUID)
      DOCUMENT ME!
      void setVOIColor​(java.awt.Color newColor)
      DOCUMENT ME!
      void setZSlider​(int zSlice)
      Places the pointer on the (slice) slider bar to a location corresponding to the given slice value (within the set) without notifying the listeners.
      void stateChanged​(javax.swing.event.ChangeEvent e)
      Sets values based on knob along slider.
      void toggleSlider()
      This method toggles between the intensities between Image A and Image B
      void updateFrames​(boolean flag, int alphaBlend)
      Calls ModelImage's updateFrames method.
      void updateScripts​(java.lang.String dir)
      Invokes the toolbar builder to update the scripts combo box based on the new script directory.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

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

      • serialVersionUID

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

        protected javax.swing.JSlider alphaSlider
        DOCUMENT ME!
      • borderActiveImage

        protected javax.swing.border.TitledBorder borderActiveImage
        DOCUMENT ME!
      • borderImageSlider

        protected javax.swing.border.TitledBorder borderImageSlider
        DOCUMENT ME!
      • gbc

        protected java.awt.GridBagConstraints gbc
        DOCUMENT ME!
      • generalPanel

        protected javax.swing.JPanel generalPanel
        DOCUMENT ME!
      • group1

        protected javax.swing.ButtonGroup group1
        DOCUMENT ME!
      • imageSize

        protected int imageSize
        DOCUMENT ME!
      • paintToolBar

        protected javax.swing.JToolBar paintToolBar
        Paint toolbar.
      • panelActiveImage

        protected javax.swing.JPanel panelActiveImage
        DOCUMENT ME!
      • panelImageSlider

        protected javax.swing.JPanel panelImageSlider
        DOCUMENT ME!
      • panelOptionToolbars

        protected javax.swing.JPanel panelOptionToolbars
        DOCUMENT ME!
      • panelToolbars

        protected javax.swing.JPanel panelToolbars
        DOCUMENT ME!
      • radioImageA

        protected javax.swing.JRadioButton radioImageA
        DOCUMENT ME!
      • radioImageB

        protected javax.swing.JRadioButton radioImageB
        DOCUMENT ME!
      • registrationToolBar

        protected javax.swing.JToolBar registrationToolBar
        Registration toolbar.
      • scriptToolBar

        protected javax.swing.JToolBar scriptToolBar
        DOCUMENT ME!
      • tImageSlider

        protected ViewJSlider tImageSlider
        tImageSlider
      • toolBar

        protected javax.swing.JToolBar toolBar
        Main toolbar .
      • toolBarObj

        protected ViewToolBarBuilder toolBarObj
        Object builds and controls the toolbars.
      • zImageSlider

        protected ViewJSlider zImageSlider
        DOCUMENT ME!
    • Constructor Detail

      • ViewControlsImage

        public ViewControlsImage​(ViewJFrameBase _frame)
        Constructs new control panel.
        Parameters:
        _frame - Parent frame.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Action event handler. Switches active image between image A and image B.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        event - Event that triggers function.
      • add

        public void add​(java.awt.Component c,
                        java.awt.GridBagConstraints gbc,
                        int x,
                        int y,
                        int w,
                        int h)
        Adds a component to the toolbar panel using the given gridbag constraints.
        Parameters:
        c - Component to add.
        gbc - Grid bag constraints for component.
        x - GridBagConstraints.gridx
        y - GridBagConstraints.gridy
        w - GridBagConstraints.gridwidth
        h - GridBagConstraints.gridheight
        See Also:
        GridBagConstraints
      • addActiveImageControl

        public void addActiveImageControl()
        Displays the panel which controls which image is the "active image" displayed when imageB is available.
      • buildToolbar

        public void buildToolbar​(boolean showImage,
                                 javax.swing.JToolBar voiToolbar,
                                 javax.swing.ButtonGroup VOIGroup,
                                 javax.swing.JToggleButton VOIPointer,
                                 boolean showPaint)
        DOCUMENT ME!
        Parameters:
        showImage - Indicates if the image toolbar is shown.
        showVOI - Indicates if the VOI toolbar is shown.
        showPaint - Indicates if the paint toolbar is shown.
        voiIndex - Indicates the index of the currently (or previously) selected VOI
      • buildToolbar

        public void buildToolbar​(boolean showImage,
                                 javax.swing.JToolBar voiToolbar,
                                 javax.swing.ButtonGroup VOIGroup,
                                 javax.swing.JToggleButton VOIPointer,
                                 boolean showPaint,
                                 boolean showScripting)
        Builds the toolbars.
        Parameters:
        showImage - Indicates if the image toolbar is shown.
        showVOI - Indicates if the VOI toolbar is shown.
        showPaint - Indicates if the paint toolbar is shown.
        showScripting - Indicates if the scripting toolbar is shown.
        voiIndex - Indicates the index of the currently (or previously) selected VOI
      • buildSimpleToolBar

        public void buildSimpleToolBar()
        Creates the main toolbar without any of the pre-made additional bars (no VOI etc) for use with addCustomToolBar() to add custom-built bars to the main bar
      • finalize

        public void finalize()
        Clean up memory.
        Overrides:
        finalize in class java.lang.Object
      • getActiveImage

        public int getActiveImage()
        Identifies which image is active.
        Returns:
        the identifier for the active image
      • getFrame

        public ViewJFrameBase getFrame()
        Accessor for the ViewJFrameBase used.
        Returns:
        the frame used
      • getTools

        public ViewToolBarBuilder getTools()
        Accessor for the tool bar held by these controls.
        Returns:
        The tool bar held by this controls.
      • removeActiveImageControl

        public void removeActiveImageControl()
        Removes the controls to the display of which image is "active" in the frame when imageB is not available.
      • runCurrentScript

        public void runCurrentScript()
        Invokes the toolbar builder to run the currently selected script.
      • setActiveImage

        public void setActiveImage​(int image)
        Sets the active image to either A or B and updates the paint spinner values.
        Parameters:
        image - Indicates which image is active.
      • setAlphaSliderEnabled

        public void setAlphaSliderEnabled​(boolean enabled)
        DOCUMENT ME!
        Parameters:
        enabled - DOCUMENT ME!
      • setRecording

        public void setRecording​(boolean isRecording)
        Used to set the state for the script recorder.
        Parameters:
        isRecording - boolean
      • setAlphaSlider

        public void setAlphaSlider​(int i)
      • setTimeSl

        public void setTimeSl​(int slice)
        Directs the image to display a particular time slice.
        Parameters:
        slice - The time slice to display.
        See Also:
        ModelImage#setTimeSlice(int)
      • setTSlider

        public void setTSlider​(int tSlice)
        Places the pointer on the (time) slider bar to a location corresponding to the given slice value (within the set).
        Parameters:
        tSlice - The slice in the frame that is displayed.
        See Also:
        JSlider
      • setVOIColor

        public void setVOIColor​(int voiUID)
        DOCUMENT ME!
        Parameters:
        voiUID - DOCUMENT ME!
      • setVOIColor

        public void setVOIColor​(java.awt.Color newColor)
        DOCUMENT ME!
        Parameters:
        newColor - DOCUMENT ME!
      • setZSlider

        public void setZSlider​(int zSlice)
        Places the pointer on the (slice) slider bar to a location corresponding to the given slice value (within the set) without notifying the listeners.
        Parameters:
        zSlice - the slice in the frame that is displayed
        See Also:
        JSlider, ViewControlsImage#updateZImageSlider(int)
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent e)
        Sets values based on knob along slider.
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        Parameters:
        e - Event that triggered this function.
      • updateFrames

        public void updateFrames​(boolean flag,
                                 int alphaBlend)
        Calls ModelImage's updateFrames method.
        Parameters:
        flag - this boolean indicates if the frame that displays the image should re-export the image and apply new LUT
        alphaBlend - the amount of alpha blending to do
        See Also:
        ModelImage#notifyImageDisplayListners
      • updateScripts

        public void updateScripts​(java.lang.String dir)
        Invokes the toolbar builder to update the scripts combo box based on the new script directory.
        Parameters:
        dir - - name of directory for script files.
      • buildAlphaSlider

        protected void buildAlphaSlider()
        Builds the slider used to control the alpha blending.
      • getTImageSlider

        public javax.swing.JSlider getTImageSlider()
      • getZImageSlider

        public javax.swing.JSlider getZImageSlider()
      • toggleSlider

        public void toggleSlider()
        This method toggles between the intensities between Image A and Image B