|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectncsa.hdf.view.Tools
The "Tools" class contains various of tools for HDF files such as jpeg to HDF converter.
Constructor Summary | |
Tools()
|
Method Summary | |
static void |
convertImageToHDF(java.lang.String imgFileName,
java.lang.String hFileName,
java.lang.String fromType,
java.lang.String toType)
Converts an image file into HDF4/5 file. |
static byte[][] |
createGrayPalette()
Creates the gray palette of the indexed 256-color table. |
static byte[][] |
createGrayWavePalette()
Creates the gray wave palette of the indexed 256-color table. |
static java.awt.Image |
createIndexedImage(byte[] imageData,
byte[][] palette,
int w,
int h)
Creates a RGB indexed image of 256 colors. |
static byte[][] |
createNaturePalette()
Creates the nature palette of the indexed 256-color table. |
static byte[][] |
createRainbowPalette()
Creates the rainbow palette of the indexed 256-color table. |
static java.awt.Image |
createTrueColorImage(byte[] imageData,
boolean planeInterlace,
int w,
int h)
Creates a true color image. |
static byte[][] |
createWavePalette()
Creates the wave palette of the indexed 256-color table. |
static byte[] |
getBytes(java.lang.Object rawData,
double[] minmax)
Convert an array of raw data into array of a byte data. |
static byte[] |
getBytes(java.lang.Object rawData,
double[] minmax,
int w,
int h,
boolean isTransposed)
Convert an array of raw data into array of a byte data. |
static boolean |
hasAlpha(java.awt.Image image)
This method returns true if the specified image has transparent pixels. |
static java.lang.Object |
newInstance(java.lang.Class cls,
java.lang.Object[] initargs)
Create and initialize a new instance of the given class. |
static void |
saveImageAs(java.awt.image.BufferedImage image,
java.io.File file,
java.lang.String type)
Save a BufferedImage into an image file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Tools()
Method Detail |
public static void convertImageToHDF(java.lang.String imgFileName, java.lang.String hFileName, java.lang.String fromType, java.lang.String toType) throws java.lang.Exception
imgFileName
- the input image file.hFileName
- the name of the HDF4/5 file.fromType
- the type of image.toType
- the type of file converted to.
java.lang.Exception
public static void saveImageAs(java.awt.image.BufferedImage image, java.io.File file, java.lang.String type) throws java.lang.Exception
image
- the BufferedImage to save.file
- the image file.type
- the image type.
java.lang.Exception
public static final byte[][] createGrayPalette()
The palette values are stored in a two-dimensional byte array and arrange by color components of red, green and blue. palette[][] = byte[3][256], where, palette[0][], palette[1][] and palette[2][] are the red, green and blue components respectively.
public static final byte[][] createGrayWavePalette()
The palette values are stored in a two-dimensional byte array and arrange by color components of red, green and blue. palette[][] = byte[3][256], where, palette[0][], palette[1][] and palette[2][] are the red, green and blue components respectively.
public static final byte[][] createRainbowPalette()
The palette values are stored in a two-dimensional byte array and arrange by color components of red, green and blue. palette[][] = byte[3][256], where, palette[0][], palette[1][] and palette[2][] are the red, green and blue components respectively.
public static final byte[][] createNaturePalette()
The palette values are stored in a two-dimensional byte array and arrange by color components of red, green and blue. palette[][] = byte[3][256], where, palette[0][], palette[1][] and palette[2][] are the red, green and blue components respectively.
public static final byte[][] createWavePalette()
The palette values are stored in a two-dimensional byte array and arrange by color components of red, green and blue. palette[][] = byte[3][256], where, palette[0][], palette[1][] and palette[2][] are the red, green and blue components respectively.
public static boolean hasAlpha(java.awt.Image image)
image
- the image to be check if has alpha.
public static 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 static 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.
public static byte[] getBytes(java.lang.Object rawData, double[] minmax)
rawData
- The input raw data.minmax
- the range of the raw data.
public static byte[] getBytes(java.lang.Object rawData, double[] minmax, int w, int h, boolean isTransposed)
rawData
- The input raw data.minmax
- the range of the raw data.isTransposed
- if the data is transposeed
public static java.lang.Object newInstance(java.lang.Class cls, java.lang.Object[] initargs) throws java.lang.Exception
initargs
- - array of objects to be passed as arguments
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |