Class ViewJComponentBase

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
ViewJComponentAnimate, ViewJComponentAnimateClip, ViewJComponentColocalizationEM, ViewJComponentColocalizationRegression, ViewJComponentEditImage, ViewJComponentLUT, ViewJComponentLUTTable, ViewJComponentPreviewImage, ViewJComponentSurface

public abstract class ViewJComponentBase extends JComponent
Abstract class used for displaying images in the program MIPAV.
Version:
1.0 August 31, 1999
Author:
Matthew J. McAuliffe, Ph.D.

$Logfile: /mipav/src/gov/nih/mipav/view/ViewJComponentBase.java $ $Revision: 135 $ $Date: 1/30/06 2:25p $

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • SMOOTH

      public static final int SMOOTH
      DOCUMENT ME!
      See Also:
    • INTERPOLATE_A

      public static final int INTERPOLATE_A
      Image interpolation only done for image A
      See Also:
    • INTERPOLATE_B

      public static final int INTERPOLATE_B
      Image interpolation only done for image B
      See Also:
    • INTERPOLATE_BOTH

      public static final int INTERPOLATE_BOTH
      Image interpolation only done for both images A and B
      See Also:
    • NEAREST_BOTH

      public static final int NEAREST_BOTH
      Nearest neighbor interpolation applied to both images
      See Also:
    • IMAGE_A

      public static final int IMAGE_A
      DOCUMENT ME!
      See Also:
    • IMAGE_B

      public static final int IMAGE_B
      DOCUMENT ME!
      See Also:
    • BOTH

      public static final int BOTH
      DOCUMENT ME!
      See Also:
    • DEFAULT

      public static final int DEFAULT
      Used to describe cursor mode, this means no VOIs will be drawn.
      See Also:
    • SELECT

      public static final int SELECT
      DOCUMENT ME!
      See Also:
    • MOVE

      public static final int MOVE
      DOCUMENT ME!
      See Also:
    • RECTANGLE

      public static final int RECTANGLE
      Indicates the MIPAV cursor is in slice rectangle VOI mode
      See Also:
    • RECTANGLE3D

      public static final int RECTANGLE3D
      Indicates the MIPAV cursor is in volume rectangle VOI mode
      See Also:
    • LEVELSET

      public static final int LEVELSET
      Indicates the MIPAV cursor is in levelset VOI mode
      See Also:
    • MOVE_POINT

      public static final int MOVE_POINT
      DOCUMENT ME!
      See Also:
    • NEW_POINT

      public static final int NEW_POINT
      DOCUMENT ME!
      See Also:
    • DELETE_POINT

      public static final int DELETE_POINT
      DOCUMENT ME!
      See Also:
    • WAND

      public static final int WAND
      DOCUMENT ME!
      See Also:
    • ELLIPSE

      public static final int ELLIPSE
      Indicates the MIPAV cursor is in ellipse VOI mode
      See Also:
    • LINE

      public static final int LINE
      Indicates the MIPAV cursor is in 2D line VOI mode
      See Also:
    • POLYLINE

      public static final int POLYLINE
      Indicates the MIPAV cursor is in polyline VOI mode
      See Also:
    • NEW_VOI

      public static final int NEW_VOI
      Indicates that a VOI has just been created, is not related to the various possible VOI modes that the handler deals with
      See Also:
    • RETRACE

      public static final int RETRACE
      DOCUMENT ME!
      See Also:
    • POINT_VOI

      public static final int POINT_VOI
      Indicates the MIPAV cursor is in point VOI mode
      See Also:
    • PAINT_VOI

      public static final int PAINT_VOI
      Indicates the MIPAV cursor is in paint VOI mode
      See Also:
    • PAINT_CAN

      public static final int PAINT_CAN
      Indicates the cursor is in paint can mode
      See Also:
    • DROPPER_PAINT

      public static final int DROPPER_PAINT
      This mode is an active VOI mode used by the VOI Handler
      See Also:
    • ERASER_PAINT

      public static final int ERASER_PAINT
      This mode is an active VOI mode used by the VOI Handler
      See Also:
    • MAG_REGION

      public static final int MAG_REGION
      DOCUMENT ME!
      See Also:
    • WIN_REGION

      public static final int WIN_REGION
      DOCUMENT ME!
      See Also:
    • QUICK_LUT

      public static final int QUICK_LUT
      This mode is used by the VOI Handler to determine whether VOIs will be drawn. A quick lut is implemented in MIPAV as a rectangle VOI
      See Also:
    • PROTRACTOR

      public static final int PROTRACTOR
      This mode is an active VOI mode used by the VOI Handler
      See Also:
    • ROTATE

      public static final int ROTATE
      Indicates the VOI cursor is in translate mode
      See Also:
    • TRANSLATE

      public static final int TRANSLATE
      Indicates the VOI cursor is in translate mode
      See Also:
    • MOVE_VOIPOINT

      public static final int MOVE_VOIPOINT
      DOCUMENT ME!
      See Also:
    • CENTER_VOI

      public static final int CENTER_VOI
      DOCUMENT ME!
      See Also:
    • CUBE_BOUNDS

      public static final int CUBE_BOUNDS
      DOCUMENT ME!
      See Also:
    • LIVEWIRE

      public static final int LIVEWIRE
      Indicates the MIPAV cursor is in livewire VOI mode
      See Also:
    • PAINT_VASC

      public static final int PAINT_VASC
      DOCUMENT ME!
      See Also:
    • ANNOTATION

      public static final int ANNOTATION
      Indicates the MIPAV cursor is in annotation VOI mode
      See Also:
    • PROBE

      public static final int PROBE
      DOCUMENT ME!
      See Also:
    • MOVE_INTERSECTION_POINT

      public static final int MOVE_INTERSECTION_POINT
      DOCUMENT ME!
      See Also:
    • ZOOMING_IN

      public static final int ZOOMING_IN
      Indicates the cursor is in zoom in mode
      See Also:
    • ZOOMING_OUT

      public static final int ZOOMING_OUT
      Indicates the cursor is in zoom out mode
      See Also:
    • POLYLINE_SLICE_VOI

      public static final int POLYLINE_SLICE_VOI
      Indicates the MIPAV cursor is in polyline slice VOI mode
      See Also:
    • SPLIT_VOI

      public static final int SPLIT_VOI
      Indicates the MIPAV cursor is in split VOI mode
      See Also:
    • VOI_3D

      public static final int VOI_3D
      Indicates the cursor is in 3D voi drawing mode while in tri-planar view
      See Also:
    • imageDim

      protected Dimension imageDim
      DOCUMENT ME!
    • img

      protected Image img
      DOCUMENT ME!
    • imgB

      protected Image imgB
      DOCUMENT ME!
    • interpMode

      protected int interpMode
      Interpolation mode for image display
    • memImageA

      protected MemoryImageSource memImageA
      DOCUMENT ME!
    • memImageB

      protected MemoryImageSource memImageB
      DOCUMENT ME!
    • resolutionX

      protected float resolutionX
      resolutionX and Y are used to correct difference in intra and inter plane voxel resolution These represent the aspect ratio of the image These are NOT to be confused with the pixel resolutions.
    • resolutionY

      protected float resolutionY
      DOCUMENT ME!
    • showSliceNumber

      protected boolean showSliceNumber
      DOCUMENT ME!
    • sliceString

      protected String sliceString
      DOCUMENT ME!
    • textColor

      protected Color textColor
      DOCUMENT ME!
    • zoomX

      protected float zoomX
      DOCUMENT ME!
    • zoomY

      protected float zoomY
      DOCUMENT ME!
    • OUT_OF_BOUNDS

      protected int OUT_OF_BOUNDS
      DOCUMENT ME!
    • lastMouseX

      protected int lastMouseX
      used by the repaintPaintBrushCursorFast method
    • lastMouseY

      protected int lastMouseY
      used by the repaintPaintBrushCursorFast method
  • Constructor Details

    • ViewJComponentBase

      public ViewJComponentBase(Dimension compDim)
      creates object of size defined by width invalid input: '&' height.
      Parameters:
      compDim - width and height of component
    • ViewJComponentBase

      public ViewJComponentBase(int width, int height, ModelImage _imageA)
      creates object of size defined by width invalid input: '&' height.
      Parameters:
      _imageA - the image that this ViewJComponentBase is a view of
      extents - the image width and height
  • Method Details

    • dispose

      public void dispose(boolean flag)
      DOCUMENT ME!
      Parameters:
      flag - DOCUMENT ME!
    • disposeLocal

      public void disposeLocal()
      Clean up some resources!
    • getImage

      public Image getImage()
      Gets the Java image.
      Returns:
      Java image
      See Also:
    • getInterpMode

      public int getInterpMode()
      Gets the interpolation mode.
      Returns:
      returns the interpolation mode
    • getLastMouseX

      public int getLastMouseX()
      Get the x position of the last place we drew something from a mouse event.
      Returns:
      the x coordinate of the last mouse event
    • getLastMouseY

      public int getLastMouseY()
      Get the y position of the last place we drew something from a mouse event.
      Returns:
      the y coordinate of the last mouse event
    • getPreferredSize

      public Dimension getPreferredSize()
      size set to object size.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      dimension with the size
    • getResolutionX

      public float getResolutionX()
      Resolution correction factor in the x - dimension.
      Returns:
      correction in the x - dimension
    • getResolutionY

      public float getResolutionY()
      Resolution correction factor in the y - dimension.
      Returns:
      correction in the y - dimension
    • getScaledX

      public int getScaledX(int x)
      Converts the screen cursor x-coordinate to scaled version using the image's pixel resolution and zoom.
      Parameters:
      x - the cursor's x-coordinate
      Returns:
      x-coordinate in image space
    • getScaledY

      public int getScaledY(int y)
      Converts the screen cursor y-coordinate to scaled version using the image's pixel resolution and zoom.
      Parameters:
      y - the cursor's y-coordinate
      Returns:
      x-coordinate in image space
    • LocalToScreen

      public void LocalToScreen(WildMagic.LibFoundation.Mathematics.Vector3f localPoint, WildMagic.LibFoundation.Mathematics.Vector3f screenPoint)
      LocalToScreen converts a point from local coordinates to screen coordinates.
      Parameters:
      localPoint - a 3D point, where x,y represent the point in local slice coordinates and the z value is the slice value.
      screenPoint - the transfromed localPoint, scaled with the image pixel resolution and zoom.
    • ScreenToLocal

      public void ScreenToLocal(WildMagic.LibFoundation.Mathematics.Vector3f screenPoint, WildMagic.LibFoundation.Mathematics.Vector3f localPoint)
      ScreenToLocal converts a point from screen coordinates to local coordinates.
      Parameters:
      screenPoint - a 3D point, where x,y represent the point in local slice coordinates and the z value is the slice value. screenPoint is usually taken from the MouseEvent point.
      localPoint - the transfromed point in local slice coordinates. The z-value represents the current slice.
    • getShowMagIntensityEnabled

      public boolean getShowMagIntensityEnabled(Graphics g, int width, int height, float mag, int imageType, double minIntensity, double maxIntensity)
      Returns whether to enable the showIntensity checkbox for mag. box
      Parameters:
      g - DOCUMENT ME!
      width - DOCUMENT ME!
      height - DOCUMENT ME!
      mag - DOCUMENT ME!
      imageType - DOCUMENT ME!
      minIntensity - DOCUMENT ME!
      maxIntensity - DOCUMENT ME!
      Returns:
      whether to enable showIntensity checkbox
    • getSize

      public Dimension getSize(Dimension wh)
      gets the size of the object taking into account the zoom.
      Overrides:
      getSize in class JComponent
      Parameters:
      wh - DOCUMENT ME!
      Returns:
      dimension with the size
    • getZoomX

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

      public float getZoomY()
      Magnification in the y - dimension.
      Returns:
      magnificaiton in the y - dimension
    • importImage

      public void importImage(int[] data)
      Creates a Image object from 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)
    • importImageB

      public void importImageB(int[] dataB)
      Creates a Image object from an array of ints that have been formatted (packed) properly (i.e. aRGB) for the magnifier in image B
      Parameters:
      dataB - Data (imageB) to be displayed that has been formatted (packed) properly (i.e. aRGB)
    • paintComponent

      public void paintComponent(Graphics g)
      Paints the image and border.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - Graphics handle
    • paintCursorBoxComponent

      public void paintCursorBoxComponent(Graphics g, int xNew, int yNew, int width, int height)
      Paints a box over the image centered about the cursor.
      Parameters:
      g - graphics component
      xNew - x coord in image
      yNew - y coord in image
      width - width of the cursor window in pixels
      height - height of the cursor window in pixels
    • paintWindowComponent

      public void paintWindowComponent(Graphics graphics, int xNew, int yNew, int width, int height, float mag)
      DOCUMENT ME!
      Parameters:
      graphics - DOCUMENT ME!
      xNew - DOCUMENT ME!
      yNew - DOCUMENT ME!
      width - DOCUMENT ME!
      height - DOCUMENT ME!
      mag - DOCUMENT ME!
    • paintWindowComponent

      public void paintWindowComponent(Graphics graphics, int xNew, int yNew, int width, int height, float mag, Image drawImage)
      Paints a image B in a window over the image centered about the cursor.
      Parameters:
      graphics - graphics component
      xNew - x coord in image
      yNew - y coord in image
      width - width of the magnification window in pixels in unit zoom
      height - height of the magnification window in pixels in unit zoom
      mag - magnification of the zoom window
      drawImage - DOCUMENT ME!
    • setInterpolationMode

      public void setInterpolationMode(int mode)
      Sets the interpolation mode.
      Parameters:
      mode - the interpolation mode (i.e. SMOOTH, NEAREST)
    • setResolutions

      public void setResolutions(float rX, float rY)
      Sets the resolution correction factor in both x and y directions.
      Parameters:
      rX - resolution correction factor in the x direction
      rY - resolution correction factor in the y direction
    • setShowSliceNumber

      public void setShowSliceNumber(boolean flag)
      Sets whether the slice number is shown.
      Parameters:
      flag - if true show slice number
    • setSliceString

      public void setSliceString(String str)
      Sets the string painted on the lower left.
      Parameters:
      str - str that is painted on the lower left of image
    • setTextColor

      public void setTextColor(Color color)
      Sets the text to the desired color.
      Parameters:
      color - color of text
    • setZoom

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

      public void setZoomExact(float zX, float zY)
      Sets the magnification to exactly the zoom specified values in both x and y directions.
      Parameters:
      zX - zoom in the x direction
      zY - zoom in the y direction
    • update

      public void update(Graphics g)
      Calls paint without erasing background - this reduces flicker!
      Overrides:
      update in class JComponent
      Parameters:
      g - Graphics handle
    • finalize

      protected void finalize() throws Throwable
      Clean up some resources!
      Overrides:
      finalize in class Object
      Throws:
      Throwable - DOCUMENT ME!
    • makePaintImage

      protected void makePaintImage(int[] paintImageBuffer, BitSet paintBitmap, int slice, ViewJFrameBase frame, boolean b2D)
      This method creates a buffer that will be used to make an image of the painted area on-screen.
      Parameters:
      paintImageBuffer - int[] the buffer to fill that will make the paint image
      paintBitmap - the bit map representing the painted pixels
      slice - the current slice to paint if this is a 3D image
      frame - the ViewJFrameBase containing the painted component.
      b2D - when true this is a 2D image component, when false it is greater than 2D
    • makePaintBitmapBorder

      protected void makePaintBitmapBorder(int[] paintImageBuffer, BitSet paintBitmap, int slice, ViewJFrameBase frame)
      This method adds an opaque border to the painted area on-screen.
      Parameters:
      paintImageBuffer - int[] the buffer the paint image will be created from
      paintBitmap - the bit map representing the painted pixels
      slice - the current slice to paint if this is a 3D image
      frame - the ViewJFrameBase containing the painted component.
    • getSelectedPaintColor

      public int getSelectedPaintColor(ViewJFrameBase vjfb)
      Gets the color of the paint the user has selected from the paint toolbar.
      Parameters:
      vjfb - the ViewJFrameBase object that contains the paint toolbar.
      Returns:
      int the color of the paint selected by the user, represented as a packed integer