Class ViewJComponentAnimate

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

    public class ViewJComponentAnimate
    extends ViewJComponentBase
    DOCUMENT ME!
    See Also:
    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
    • Constructor Summary

      Constructors 
      Constructor Description
      ViewJComponentAnimate​(ViewJFrameBase _frame, ModelImage _imageA, ModelLUT _LUTa, float[] imgBufferA, ModelImage _imageB, ModelLUT _LUTb, float[] imgBufferB, int[] pixelBuffer, float zoom, int[] extents, boolean logMagDisplay, float alphaBl, boolean disposeImage)
      Constructor: ImageA and ImageB are expected to be of the same dimensionality !!
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean buildImageObject​(int tSlice, int zSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow)
      Shows the image.
      void displayNumbers​(boolean showNumbers)
      In 4D whether to show numbers for each z slice.
      void dispose​(boolean gcFlag)
      Sets all variables to null, disposes, and garbage collects.
      void finalizeLocal()
      Clean up some resources!
      ModelImage getActiveImage()
      Accessor that returns the active image.
      int getblue()
      Accessor that returns int blue.
      int getgreen()
      Accessor that returns int green.
      java.awt.Image getImage()
      Gets Java image.
      ModelImage getImageA()
      Accessor that returns the imageA.
      ModelImage getImageB()
      Accessor that returns the imageB.
      float getOPACITY()
      Accessor that returns float OPACITY.
      java.util.BitSet getpaintBitmap()
      Accessor that returns BitSet paintBitmap.
      java.awt.Dimension getPreferredSize()
      Size set to object size.
      int getred()
      Accessor that returns int red.
      java.awt.Dimension getSize​(java.awt.Dimension wh)
      Gets the size of the object taking into account the zoom.
      float getZoomX()
      Magnification in the x - dimension.
      float getZoomY()
      Magnification in the y - dimension.
      void ignoreSlice()
      Method to ensure img[slice] is not displayed.
      void importImage​(int[] data)
      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 image and border.
      void set4DSpecs​(int originalZDim, int nColumn, int nRow)
      Specifications that are only relevant to 4D images.
      void setAlphaBlend​(int value)
      Sets the alpha blending of parameter for two image displaying.
      void setBorderCol​(java.awt.Color borderCol)
      Sets color of the border surrounding each z slice in 4D images.
      void setBrightness​(int brightness, float contrast)
      Method to set the brightness and contrast of the animate images.
      void setBuffers​(float[] imgBufferA, float[] imgBufferB, int[] pixBuff, int[] paintBuff)
      The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.
      void setLabelXY()
      For 4D sets the numbering string of each z slice and its x and y positions.
      void setLabelZ()
      setlabelZ - For 3D sets the numbering string of each frame.
      void setPaintMask()
      Sets the paintBitmap to produce colored borders for 4D images.
      void setPaintMask​(java.util.BitSet mask)
      Accessor that sets the paint mask.
      void setRGBTA​(ModelRGB RGBT)
      Sets the RGB table for the ARGB image A.
      void setRGBTB​(ModelRGB RGBT)
      Sets the RGB table for the ARGB image B.
      void setSlice​(int _slice)
      Accessor that sets the slice of the image.
      void setSliceBrightness​(int brightness, float contrast)
      Method to set the brightness and contrast of the animate slice.
      void setZoom​(float zX, float zY)
      Sets the magnification in both x and y directions.
      void update()
      Method to call paint without erasing background this reduces flicker!
      void update​(java.awt.Graphics g)
      Method to call paint without erasing background this reduces flicker!
      • 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
      • OPACITY

        public float OPACITY
        Opacity value used by the paint brush. value = 1.0 - opaque value = 0.25 - default (mostly see through)
      • alphaBlend

        protected float alphaBlend
        alphaBlending values for compositing two images.
      • frame

        protected ViewJFrameBase frame
        frame - frame where the component image is displayed.
      • imageA

        protected ModelImage imageA
        imageA - model for image A.
      • imageB

        protected ModelImage imageB
        imageB - model for image B.
      • img

        protected java.awt.Image[] img
        the image rendered in 2D graphics:
      • paintImageBuffer

        private int[] paintImageBuffer
      • slice

        protected int slice
        current slice for 3D images:
      • brightness

        private int brightness
        offset ranging from -255 to 255 add to each scaled red, green, and blue
      • contrast

        private float contrast
        scale factor ranging from 0.1 to 10.0 by which to multiply each red, green, and blue
      • disposeImage

        private boolean disposeImage
        whether or not to dispose of imageA and imageB true unless ViewJFrameAnimate was passed an unscaled 3D image
      • haveFiltered

        private boolean haveFiltered
        whether or not the brightness/contrast filter has been invoked
      • ignoreSlice

        private boolean[] ignoreSlice
        set true if deleteSlice hit in ViewJFrameAnimate
      • imageActive

        private ModelImage imageActive
        Which image is currently active
      • mt

        private java.awt.MediaTracker mt
        DOCUMENT ME!
      • nRow

        private int nRow
        in 4D row and column numbers for z slices
      • nColumn

        private int nColumn
        in 4D row and column numbers for z slices
      • nVOI

        private int nVOI
        number of vois
      • originalZDim

        private int originalZDim
        the number of z slices in a 4D image equal to zDim before the JDialogAnimate 4D to 3D conversion
      • paintBitmap

        private java.util.BitSet paintBitmap
        Buffer used to indicate if the pixel location is painted (true) or unpainted (false).
      • paintBuffer

        private int[] paintBuffer
        Buffer that displays the combined paintBitmap and pixBuffer buffers.
      • red

        private int red
        Border color, red, green, and blue components:
      • green

        private int green
        Border color, red, green, and blue components:
      • blue

        private int blue
        Border color, red, green, and blue components:
      • showNumbers

        private boolean showNumbers
        whether to number each z slice for 4D
      • xDim

        private int xDim
        image x, y, z dimensions in FileCoordinates
      • yDim

        private int yDim
        image x, y, z dimensions in FileCoordinates
      • zDim

        private int zDim
        image x, y, z dimensions in FileCoordinates
      • xLabel

        private int[] xLabel
        in 4D x location of slice numbering string
      • yLabel

        private int[] yLabel
        in 4D y location of slice numbering string
      • zString

        private java.lang.String[] zString
        string for displaying slice number
      • m_kPatientSlice

        private PatientSlice m_kPatientSlice
        PatientSlice contains all the Patient Coordinate system view-specific data for rendering this component:
    • Constructor Detail

      • ViewJComponentAnimate

        public ViewJComponentAnimate​(ViewJFrameBase _frame,
                                     ModelImage _imageA,
                                     ModelLUT _LUTa,
                                     float[] imgBufferA,
                                     ModelImage _imageB,
                                     ModelLUT _LUTb,
                                     float[] imgBufferB,
                                     int[] pixelBuffer,
                                     float zoom,
                                     int[] extents,
                                     boolean logMagDisplay,
                                     float alphaBl,
                                     boolean disposeImage)
        Constructor: ImageA and ImageB are expected to be of the same dimensionality !!
        Parameters:
        _frame - frame where the controls are obtained
        _imageA - Model of the image that will be displayed
        _LUTa - LUT used to display imageA
        imgBufferA - storage buffer used to display image A
        _imageB - Model of the image that will be displayed
        _LUTb - LUT used to display imageB
        imgBufferB - storage buffer used to display image B
        pixelBuffer - storage buffer used to build a displayable image
        zoom - initial magnification of image
        extents - initial display dimensions of the image
        logMagDisplay - display log magnitude of image
        alphaBl - alphaBlend
        disposeImage - if true dispose of imageA and imageB
    • Method Detail

      • buildImageObject

        public boolean buildImageObject​(int tSlice,
                                        int zSlice,
                                        ModelLUT _LUTa,
                                        ModelLUT _LUTb,
                                        boolean forceShow)
        Shows the image.
        Parameters:
        tSlice - t (time) slice to show
        zSlice - z slice to show
        _LUTa - LUTa - to change to new LUT for imageA else null
        _LUTb - LUTb - to change to new LUT for imageB else null
        forceShow - forces this method to import image and recalculate java image
        Returns:
        boolean to indicate if the show was successful
      • displayNumbers

        public void displayNumbers​(boolean showNumbers)
        In 4D whether to show numbers for each z slice.
        Parameters:
        showNumbers - if true display numbers for each z slice in 4D
      • dispose

        public void dispose​(boolean gcFlag)
        Sets all variables to null, disposes, and garbage collects.
        Overrides:
        dispose in class ViewJComponentBase
        Parameters:
        gcFlag - if true garbage collector should be called.
      • finalizeLocal

        public void finalizeLocal()
        Clean up some resources!
      • getActiveImage

        public ModelImage getActiveImage()
        Accessor that returns the active image.
        Returns:
        active image
      • getblue

        public int getblue()
        Accessor that returns int blue.
        Returns:
        blue
      • getgreen

        public int getgreen()
        Accessor that returns int green.
        Returns:
        green
      • getImage

        public java.awt.Image getImage()
        Gets Java image.
        Overrides:
        getImage in class ViewJComponentBase
        Returns:
        Java image
        See Also:
        Image
      • getImageA

        public ModelImage getImageA()
        Accessor that returns the imageA.
        Returns:
        imageA
      • getImageB

        public ModelImage getImageB()
        Accessor that returns the imageB.
        Returns:
        imageB
      • getOPACITY

        public float getOPACITY()
        Accessor that returns float OPACITY.
        Returns:
        OPACITY
      • getpaintBitmap

        public java.util.BitSet getpaintBitmap()
        Accessor that returns BitSet paintBitmap.
        Returns:
        paintBitmap
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Size set to object size.
        Overrides:
        getPreferredSize in class ViewJComponentBase
        Returns:
        dimension with the size
      • getred

        public int getred()
        Accessor that returns int red.
        Returns:
        red
      • getSize

        public java.awt.Dimension getSize​(java.awt.Dimension wh)
        Gets the size of the object taking into account the zoom.
        Overrides:
        getSize in class ViewJComponentBase
        Parameters:
        wh - dimension
        Returns:
        dimension with the size
      • getZoomX

        public float getZoomX()
        Magnification in the x - dimension.
        Overrides:
        getZoomX in class ViewJComponentBase
        Returns:
        magnificaiton in the x - dimension
      • getZoomY

        public float getZoomY()
        Magnification in the y - dimension.
        Overrides:
        getZoomY in class ViewJComponentBase
        Returns:
        magnificaiton in the y - dimension
      • ignoreSlice

        public void ignoreSlice()
        Method to ensure img[slice] is not displayed.
      • importImage

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

        public void paintComponent​(java.awt.Graphics g)
        Paints the image and border.
        Overrides:
        paintComponent in class ViewJComponentBase
        Parameters:
        g - Graphics handle
      • set4DSpecs

        public void set4DSpecs​(int originalZDim,
                               int nColumn,
                               int nRow)
        Specifications that are only relevant to 4D images.
        Parameters:
        originalZDim - number of z slices
        nColumn - the number of columns of z slices
        nRow - the number of rows of z slices
      • setAlphaBlend

        public void setAlphaBlend​(int value)
        Sets the alpha blending of parameter for two image displaying.
        Parameters:
        value - amount [0,100] that is the percentage of Image A to be displayed
      • setBorderCol

        public void setBorderCol​(java.awt.Color borderCol)
        Sets color of the border surrounding each z slice in 4D images.
        Parameters:
        borderCol - border color surounding each z slice
      • setBrightness

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

        public void setBuffers​(float[] imgBufferA,
                               float[] imgBufferB,
                               int[] pixBuff,
                               int[] paintBuff)
        The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.
        Parameters:
        imgBufferA - storage buffer used to display image A
        imgBufferB - storage buffer used to display image B
        pixBuff - storage buffer used to build a displayable image
        paintBuff - storage buffer used to display the combined paintBitmap and pixBuffer buffers
      • setLabelXY

        public void setLabelXY()
        For 4D sets the numbering string of each z slice and its x and y positions.
      • setLabelZ

        public void setLabelZ()
        setlabelZ - For 3D sets the numbering string of each frame.
      • setPaintMask

        public void setPaintMask()
        Sets the paintBitmap to produce colored borders for 4D images.
      • setPaintMask

        public void setPaintMask​(java.util.BitSet mask)
        Accessor that sets the paint mask.
        Parameters:
        mask - DOCUMENT ME!
      • setRGBTA

        public void setRGBTA​(ModelRGB RGBT)
        Sets the RGB table for the ARGB image A.
        Parameters:
        RGBT - RGB table
      • setRGBTB

        public void setRGBTB​(ModelRGB RGBT)
        Sets the RGB table for the ARGB image B.
        Parameters:
        RGBT - RGB table
      • setSlice

        public void setSlice​(int _slice)
        Accessor that sets the slice of the image.
        Parameters:
        _slice - image slice to be displayed
      • 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
      • setZoom

        public void setZoom​(float zX,
                            float zY)
        Sets the magnification in both x and y directions.
        Overrides:
        setZoom in class ViewJComponentBase
        Parameters:
        zX - zoom in the x direction
        zY - zoom in the y direction
      • update

        public void update()
        Method to call paint without erasing background this reduces flicker!
      • update

        public void update​(java.awt.Graphics g)
        Method to call paint without erasing background this reduces flicker!
        Overrides:
        update in class ViewJComponentBase
        Parameters:
        g - Graphics handle