|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JInternalFrame
ncsa.hdf.view.DefaultImageView
public class DefaultImageView
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 verion 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
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JInternalFrame |
---|
javax.swing.JInternalFrame.JDesktopIcon |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
FLIP_HORIZONTAL
Horizontal direction to flip an image. |
static int |
FLIP_VERTICAL
Vertical direction to flip an image. |
static int |
ROTATE_CCW_90
ROTATE IMAGE COUNTER CLOCKWISE 90 DEGREE. |
static int |
ROTATE_CW_90
ROTATE IMAGE 90 DEGREE CLOCKWISE. |
static long |
serialVersionUID
|
Fields inherited from class javax.swing.JInternalFrame |
---|
CONTENT_PANE_PROPERTY, FRAME_ICON_PROPERTY, GLASS_PANE_PROPERTY, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY, LAYERED_PANE_PROPERTY, MENU_BAR_PROPERTY, ROOT_PANE_PROPERTY, TITLE_PROPERTY |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface ncsa.hdf.view.DataView |
---|
DATAVIEW_IMAGE, DATAVIEW_TABLE, DATAVIEW_TEXT, DATAVIEW_UNKNOWN |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DefaultImageView(ViewManager theView)
Constructs an ImageView. |
|
DefaultImageView(ViewManager theView,
java.util.HashMap map)
Constructs an ImageView. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
java.awt.Image |
createIndexedImage(byte[] imageData,
byte[][] palette,
int w,
int h)
Creates a RGB indexed image of 256 colors. |
java.awt.Image |
createTrueColorImage(byte[] imageData,
boolean planeInterlace,
int w,
int h)
Creates a true color image. |
void |
dispose()
Disposes this datao viewer |
HObject |
getDataObject()
returns the data object displayed in this data viewer |
java.awt.Image |
getImage()
returns the image displayed in this imageView |
byte[] |
getImageByteData()
returns the byte array of the image data |
byte[][] |
getPalette()
returns the palette of the image |
java.awt.Rectangle |
getSelectedArea()
returns the selected area of the image |
java.lang.Object |
getSelectedData()
Returns the selected data values. |
boolean |
isPlaneInterlace()
|
boolean |
isTrueColor()
|
void |
setImage(java.awt.Image img)
sets the image |
void |
setPalette(byte[][] pal)
sets the image palette |
Methods inherited from class javax.swing.JInternalFrame |
---|
addInternalFrameListener, doDefaultCloseAction, getAccessibleContext, getContentPane, getDefaultCloseOperation, getDesktopIcon, getDesktopPane, getFocusCycleRootAncestor, getFocusOwner, getFrameIcon, getGlassPane, getInternalFrameListeners, getJMenuBar, getLastCursor, getLayer, getLayeredPane, getMenuBar, getMostRecentFocusOwner, getNormalBounds, getRootPane, getTitle, getUI, getUIClassID, getWarningString, hide, isClosable, isClosed, isFocusCycleRoot, isIcon, isIconifiable, isMaximizable, isMaximum, isResizable, isSelected, moveToBack, moveToFront, pack, remove, removeInternalFrameListener, reshape, restoreSubcomponentFocus, setClosable, setClosed, setContentPane, setCursor, setDefaultCloseOperation, setDesktopIcon, setFocusCycleRoot, setFrameIcon, setGlassPane, setIcon, setIconifiable, setJMenuBar, setLayer, setLayer, setLayeredPane, setLayout, setMaximizable, setMaximum, setMenuBar, setNormalBounds, setResizable, setSelected, setTitle, setUI, show, toBack, toFront, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long serialVersionUID
public static final int FLIP_HORIZONTAL
public static final int FLIP_VERTICAL
public static final int ROTATE_CW_90
public static final int ROTATE_CCW_90
Constructor Detail |
---|
public DefaultImageView(ViewManager theView)
theView
- the main HDFView.public DefaultImageView(ViewManager theView, java.util.HashMap map)
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 Detail |
---|
public java.awt.Image getImage()
ImageView
getImage
in interface ImageView
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void dispose()
DataView
dispose
in interface DataView
dispose
in class javax.swing.JInternalFrame
public HObject getDataObject()
DataView
getDataObject
in interface DataView
public byte[] getImageByteData()
ImageView
getImageByteData
in interface ImageView
public java.lang.Object getSelectedData()
getSelectedData
in interface ImageView
public java.awt.Rectangle getSelectedArea()
getSelectedArea
in interface ImageView
public boolean isTrueColor()
isTrueColor
in interface ImageView
public boolean isPlaneInterlace()
isPlaneInterlace
in interface ImageView
public void setImage(java.awt.Image img)
ImageView
setImage
in interface ImageView
public byte[][] getPalette()
ImageView
getPalette
in interface ImageView
public void setPalette(byte[][] pal)
ImageView
setPalette
in interface ImageView
public java.awt.Image createIndexedImage(byte[] imageData, byte[][] palette, int w, int h)
imageData
- the byte array of the image data.palette
- the color lookup table.w
- the width of the image.h
- the height of the image.
public java.awt.Image createTrueColorImage(byte[] imageData, boolean planeInterlace, int w, int h)
DirectColorModel is used to construct the image from raw data. The
DirectColorModel model is similar to an X11 TrueColor visual, which has
the following parameters:
Number of bits: 32 Red mask: 0x00ff0000 Green mask: 0x0000ff00 Blue mask: 0x000000ff Alpha mask: 0xff000000 Color space: sRGB isAlphaPremultiplied: False Transparency: Transparency.TRANSLUCENT transferType: DataBuffer.TYPE_INT
The data may be arranged in one of two ways: by pixel or by plane. In both cases, the dataset will have a dataspace with three dimensions, height, width, and components.
For HDF4, the interlace modes specify orders for the dimensions as:
INTERLACE_PIXEL = [width][height][pixel components] INTERLACE_PLANE = [pixel components][width][height]
For HDF5, the interlace modes specify orders for the dimensions as:
INTERLACE_PIXEL = [height][width][pixel components] INTERLACE_PLANE = [pixel components][height][width]
imageData
- the byte array of the image data.planeInterlace
- flag if the image is plane intelace.w
- the width of the image.h
- the height of the image.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |