Class ViewJComponentPreviewImage

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

    public class ViewJComponentPreviewImage
    extends ViewJComponentBase
    Preview image displayed when the user clicks on an image file in the directory tree. For black and white, a default LUT is created. The image is resized if the panel holding it is resized.
    Version:
    1.0
    Author:
    Neva Cherniavsky
    See Also:
    ViewImageDirectory, Serialized Form
    • Nested Class Summary

      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean createImg​(int slice)
      Creates the Java image to be displayed from the model image.
      void dispose​(boolean gc)
      Sets buffers to null.
      ModelImage getImageA()
      Get source image
      int getImageSize()
      Gets the size of the image (width * height).
      java.awt.Dimension getPreferredSize()
      Size set to object size.
      void importImage​(int[] data, boolean haveFilter)
      Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)
      void paintComponent​(java.awt.Graphics g)
      Paints the component using the previous set image width and height.
      void setImageA​(ModelImage image)
      Sets component's image A.
      void setImgSize​(int width, int height)
      Sets the size of the image to be painted.
      void setSliceBrightness​(int brightness, float contrast)
      Method to set the brightness and contrast of the animate slice.
      • 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, getRegisteredKeyStrokes, getRootPane, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
      • 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, getAccessibleContext, 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
      • brightness

        private int brightness
        DOCUMENT ME!
      • contrast

        private float contrast
        DOCUMENT ME!
      • imageSize

        private final int imageSize
        DOCUMENT ME!
      • imgHeight

        private int imgHeight
        DOCUMENT ME!
      • imgWidth

        private int imgWidth
        DOCUMENT ME!
      • memImage

        private java.awt.image.MemoryImageSource memImage
        DOCUMENT ME!
      • paintBuffer

        private int[] paintBuffer
        DOCUMENT ME!
      • panelHeight

        private int panelHeight
        DOCUMENT ME!
      • panelWidth

        private int panelWidth
        DOCUMENT ME!
      • m_kPatientSlice

        private final PatientSlice m_kPatientSlice
        PatientSlice interfaces with the ModelImage class to render the image w/LUT changes for this component. Slices are rendered in FileCoordinates.
      • image

        private ModelImage image
        The model image this preview image is derived from.
      • overlayText

        private java.lang.String overlayText
        Overlay text to show on the image.
    • Constructor Detail

      • ViewJComponentPreviewImage

        public ViewJComponentPreviewImage​(ModelImage _image,
                                          int[] extents,
                                          PreviewImageContainer _parent)
        Creates new preview image from the model image. The extents will only be 2D. The parent is needed because of the order in which Java calls methods when a component is resized.
        Parameters:
        _image - Model image to create preview image from.
        extents - X and Y dimensions of image
        _parent - Frame that called this
    • Method Detail

      • createImg

        public boolean createImg​(int slice)
        Creates the Java image to be displayed from the model image. Makes it from the appropriate slice.
        Parameters:
        slice - Slice of image to create java image from.
        Returns:
        Flag indicating success or failure.
      • dispose

        public void dispose​(boolean gc)
        Sets buffers to null.
        Overrides:
        dispose in class ViewJComponentBase
        Parameters:
        gc - Flag indicating if the garbage collector should be called.
      • getImageSize

        public int getImageSize()
        Gets the size of the image (width * height).
        Returns:
        the size of the image
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Size set to object size. Need to get real panel size first from the parent, then reset the image size.
        Overrides:
        getPreferredSize in class ViewJComponentBase
        Returns:
        Dimension with the size
      • importImage

        public void importImage​(int[] data,
                                boolean haveFilter)
        Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)
        Parameters:
        data - Data (image) to be displayed that has been formatted (packed) properly (i.e. aRGB)
        haveFilter - DOCUMENT ME!
      • paintComponent

        public void paintComponent​(java.awt.Graphics g)
        Paints the component using the previous set image width and height.
        Overrides:
        paintComponent in class ViewJComponentBase
        Parameters:
        g - Graphics to draw image in.
      • getImageA

        public ModelImage getImageA()
        Get source image
        Returns:
        ModelImage
      • setImageA

        public void setImageA​(ModelImage image)
        Sets component's image A.
        Parameters:
        image - Image to set to.
      • setImgSize

        public void setImgSize​(int width,
                               int height)
        Sets the size of the image to be painted.
        Parameters:
        width - Width of panel where image will be placed.
        height - Height of panel where image will be placed.
      • setSliceBrightness

        public void setSliceBrightness​(int brightness,
                                       float contrast)
        Method to set the brightness and contrast of the animate slice.
        Parameters:
        brightness - int going from -255 to 255
        contrast - float scale factor