Class ViewJComponentPreviewImage

All Implemented Interfaces:
ImageObserver, MenuContainer, 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • 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 MemoryImageSource memImage
      DOCUMENT ME!
    • paintBuffer

      private int[] paintBuffer
      DOCUMENT ME!
    • panelHeight

      private int panelHeight
      DOCUMENT ME!
    • panelWidth

      private int panelWidth
      DOCUMENT ME!
    • parent

      private final PreviewImageContainer parent
      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 String overlayText
      Overlay text to show on the image.
  • Constructor Details

    • 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 Details

    • 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 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(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