Module org.hdfgroup.hdfview
Package hdf.view.ImageView

# Class DefaultImageView

Object
hdf.view.ImageView.DefaultImageView

All Implemented Interfaces:
  `DataView`, `ImageView`

public class DefaultImageView extends Object implements ImageView
ImageView displays an HDF dataset as an image. A scalar dataset in HDF can be displayed in image or table. By default, an HDF4 GR image and HDF5 image is displayed as an image. Other scalar datasets are display in a two-dimensional table. Users can also choose to display a scalar dataset as image. Currently this version of the ImageView only supports 8-bit raster image with indexed RGB color model of 256 colors or 24-bit true color raster image. Data of other type will be converted to 8-bit integer. The simple linear conversion is used for this purpose:

     y = f * (x - min),
           where y   = the value of 8-bit integer,
                 x   = the value of original data,
                 f   = 255/(max-min), conversion factor,
                 max = the maximum of the original data,
                 min = the minimum of the original data.

A default color table is provided for images without palette attached to it. Current choice of default palettes include Gray, Rainbow, Nature and Wave. For more infomation on palette, read HDF5 Image and Palette Specification

Version:
  2.4 2//2016
Author:
  Jordan T. Henderson

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `DefaultImageView.FlipFilter`
  FlipFilter creates image filter to flip image horizontally or vertically.
  `static class`
  `DefaultImageView.Rotate90Filter`
  Makes an image filter for rotating image by 90 degrees.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `FLIP_HORIZONTAL`
  Horizontal direction to flip an image.
  `static final int`
  `FLIP_VERTICAL`
  Vertical direction to flip an image.
  `static final int`
  `ROTATE_CCW_90`
  ROTATE IMAGE COUNTER CLOCKWISE 90 DEGREE.
  `static final int`
  `ROTATE_CW_90`
  ROTATE IMAGE 90 DEGREE CLOCKWISE.

  ### Fields inherited from interface hdf.view.DataView.DataView

  `DATAVIEW_IMAGE, DATAVIEW_TABLE, DATAVIEW_UNKNOWN`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultImageView(DataViewManager theView)`
  Constructs an ImageView.
  `DefaultImageView(DataViewManager theView, HashMap map)`
  Constructs an ImageView.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `HObject`
  `getDataObject()`
  `Image`
  `getImage()`
  `byte[]`
  `getImageByteData()`
  `byte[][]`
  `getPalette()`
  `Rectangle`
  `getSelectedArea()`
  returns the selected area of the image
  `Object`
  `getSelectedData()`
  Returns the selected data values.
  `boolean`
  `isPlaneInterlace()`
  `boolean`
  `isTrueColor()`
  `void`
  `setImage(Image img)`
  Sets the image
  `void`
  `setPalette(byte[][] pal)`
  Sets the image palette

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FLIP_HORIZONTAL

    public static final int FLIP_HORIZONTAL
    Horizontal direction to flip an image.
    See Also:
      - Constant Field Values

  - ### FLIP_VERTICAL

    public static final int FLIP_VERTICAL
    Vertical direction to flip an image.
    See Also:
      - Constant Field Values

  - ### ROTATE_CW_90

    public static final int ROTATE_CW_90
    ROTATE IMAGE 90 DEGREE CLOCKWISE.
    See Also:
      - Constant Field Values

  - ### ROTATE_CCW_90

    public static final int ROTATE_CCW_90
    ROTATE IMAGE COUNTER CLOCKWISE 90 DEGREE.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DefaultImageView

    public DefaultImageView(DataViewManager theView)
    Constructs an ImageView.
    Parameters:
      `theView` - the main HDFView.

  - ### DefaultImageView

    public DefaultImageView(DataViewManager theView, HashMap map)
    Constructs an ImageView.
    Parameters:
      `theView` - the main HDFView.
      `map` - the properties on how to show the data. The map is used to allow applications to pass properties on how to display the data, such as, transposing data, showing data as character, applying bitmask, and etc. Predefined keys are listed at ViewProperties.DATA_VIEW_KEY.

- ## Method Details

  - ### getImage

    public Image getImage()
    Specified by:
      `getImage` in interface `ImageView`
    Returns:
      the image displayed in this imageView

  - ### getDataObject

    public HObject getDataObject()
    Specified by:
      `getDataObject` in interface `DataView`
    Returns:
      the data object displayed in this data viewer

  - ### getImageByteData

    public byte[] getImageByteData()
    Specified by:
      `getImageByteData` in interface `ImageView`
    Returns:
      the byte array of the image data

  - ### getSelectedData

    public Object getSelectedData()
    Returns the selected data values.
    Specified by:
      `getSelectedData` in interface `ImageView`
    Returns:
      the selected data object.

  - ### getSelectedArea

    public Rectangle getSelectedArea()
    returns the selected area of the image
    Specified by:
      `getSelectedArea` in interface `ImageView`
    Returns:
      the rectangle of the selected image area.

  - ### isTrueColor

    public boolean isTrueColor()
    Specified by:
      `isTrueColor` in interface `ImageView`
    Returns:
      true if the image is a truecolor image.

  - ### isPlaneInterlace

    public boolean isPlaneInterlace()
    Specified by:
      `isPlaneInterlace` in interface `ImageView`
    Returns:
      true if the image interlace is plance interlace.

  - ### setImage

    public void setImage(Image img)
    Description copied from interface: `ImageView`
    Sets the image
    Specified by:
      `setImage` in interface `ImageView`
    Parameters:
      `img` - the image to view

  - ### getPalette

    public byte[][] getPalette()
    Specified by:
      `getPalette` in interface `ImageView`
    Returns:
      the palette of the image

  - ### setPalette

    public void setPalette(byte[][] pal)
    Description copied from interface: `ImageView`
    Sets the image palette
    Specified by:
      `setPalette` in interface `ImageView`
    Parameters:
      `pal` - the palette for the image to view