|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectncsa.hdf.object.HObject
ncsa.hdf.object.Dataset
ncsa.hdf.object.ScalarDS
public abstract class ScalarDS
A scalar dataset is a multiple dimension array of scalar points. The Datatype of a scalar dataset must be an atomic datatype. Common datatypes of scalar datasets include char, byte, short, int, long, float, double and string.
A ScalarDS can be an image or spreadsheet data. ScalarDS defines few methods to deal with both images and spreadsheets.
ScalarDS is an abstract class. Current implementing classes are the H4SDS, H5GRImage and H5ScalarDS.
Field Summary | |
---|---|
static int |
INTERLACE_LINE
Indicates that each pixel component of RGB is stored as a scan line. |
static int |
INTERLACE_PIXEL
Indicates that the pixel RGB values are contiguous. |
static int |
INTERLACE_PLANE
Indicates that each pixel component of RGB is stored as a plane. |
boolean |
isFillValueConverted
Flag to indicate if the FillValue is converted from unsigned C. |
Fields inherited from class ncsa.hdf.object.HObject |
---|
separator, serialVersionUID |
Constructor Summary | |
---|---|
ScalarDS(FileFormat theFile,
java.lang.String theName,
java.lang.String thePath)
Constructs an instance of a ScalarDS with specific name and path. |
|
ScalarDS(FileFormat theFile,
java.lang.String theName,
java.lang.String thePath,
long[] oid)
Deprecated. Not for public use in the future. Using ScalarDS(FileFormat, String, String) |
Method Summary | |
---|---|
void |
clearData()
Clears the data buffer in memory and to force the next read() to load data from file. |
java.lang.Object |
convertFromUnsignedC()
Converts the data values of this dataset to appropriate Java integer if they are unsigned integers. |
java.lang.Object |
convertToUnsignedC()
Converts Java integer data of this dataset back to unsigned C-type integer data if they are unsigned integers. |
java.lang.Object |
getFillValue()
Returns the fill values for the dataset. |
double[] |
getImageDataRange()
Returns the (min, max) pair of image data range. |
int |
getInterlace()
Returns the interlace mode of a true color image (RGB). |
abstract byte[][] |
getPalette()
Returns the palette of this scalar dataset or null if palette does not exist. |
java.lang.String |
getPaletteName(int idx)
Get the name of a specific image palette from file. |
abstract byte[] |
getPaletteRefs()
Returns the byte array of palette refs. |
boolean |
isDefaultImageOrder()
Returns true if this dataset is displayed as an image with default image order. |
boolean |
isImage()
Returns true if this dataset is an image. |
boolean |
isImageDisplay()
Returns true if this dataset is displayed as an image. |
boolean |
isText()
Returns true if this dataset is ASCII text. |
boolean |
isTrueColor()
Returns true if this dataset is a true color image. |
boolean |
isUnsigned()
Returns true if the original C data are unsigned integers. |
abstract byte[][] |
readPalette(int idx)
Reads a specific image palette from file. |
void |
setIsImage(boolean b)
Sets the flag to indicate this dataset is an image. |
void |
setIsImageDisplay(boolean b)
Sets the flag to display the dataset as an image. |
void |
setPalette(byte[][] pal)
Sets the palette for this dataset. |
Methods inherited from class ncsa.hdf.object.Dataset |
---|
byteToString, clear, convertFromUnsignedC, convertFromUnsignedC, convertToUnsignedC, convertToUnsignedC, copy, getChunkSize, getCompression, getConvertByteToString, getData, getDatatype, getDimNames, getDims, getHeight, getMaxDims, getRank, getSelectedDims, getSelectedIndex, getSize, getStartDims, getStride, getWidth, init, isEnumConverted, isString, read, readBytes, setConvertByteToString, setData, setEnumConverted, stringToByte, write, write |
Methods inherited from class ncsa.hdf.object.HObject |
---|
close, equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, open, setLinkTargetObjName, setName, setPath, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ncsa.hdf.object.DataFormat |
---|
getMetadata, hasAttribute, removeMetadata, writeMetadata |
Field Detail |
---|
public static final int INTERLACE_PIXEL
public static final int INTERLACE_LINE
public static final int INTERLACE_PLANE
public boolean isFillValueConverted
Constructor Detail |
---|
public ScalarDS(FileFormat theFile, java.lang.String theName, java.lang.String thePath)
For example, in H5ScalarDS(h5file, "dset", "/arrays/"), "dset" is the name of the dataset, "/arrays" is the group path of the dataset.
theFile
- the file that contains the data object.theName
- the name of the data object, e.g. "dset".thePath
- the full path of the data object, e.g. "/arrays/".@Deprecated public ScalarDS(FileFormat theFile, java.lang.String theName, java.lang.String thePath, long[] oid)
ScalarDS(FileFormat, String, String)
Method Detail |
---|
public void clearData()
Dataset
The function read() loads data from file into memory only if the data is not read. If data is already in memory, read() just returns the memory buffer. Sometimes we want to force read() to re-read data from file. For example, when the selection is changed, we need to re-read the data. clearData() clears the current memory buffer and force the read() to load the data from file.
clearData
in class Dataset
Dataset.getData()
,
Dataset.read()
public java.lang.Object convertFromUnsignedC()
Dataset.convertToUnsignedC(Object)
,
Dataset.convertFromUnsignedC(Object, Object)
public java.lang.Object convertToUnsignedC()
Dataset.convertToUnsignedC(Object)
,
Dataset.convertToUnsignedC(Object, Object)
,
Dataset.convertFromUnsignedC(Object data_in)
public abstract byte[][] getPalette()
Scalar dataset can be displayed as spreadsheet data or image. When a scalar dataset is chosen to display as an image, the palette or color table may be needed to translate a pixel value to color components (for example, red, green, and blue). Some scalar datasets have no palette and some datasets have one or more than one palettes. If an associated palette exists but not loaded, this interface retrieves the palette from the file and returns the palette. If the palette is loaded, it returnd the palette. It returns null if there is no palette assciated with the dataset.
Current implementation only supports palette model of indexed RGB with 256 colors. Other models such as YUV", "CMY", "CMYK", "YCbCr", "HSV will be supported in the future.
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.
Sub-classes have to implement this interface. HDF4 and HDF5 images use different libraries to retrieve the associated palette.
public final void setPalette(byte[][] pal)
pal
- the 2D palette byte array.public abstract byte[][] readPalette(int idx)
A scalar dataset may have multiple palettes attached to it. readPalette(int idx) returns a specific palette identified by its index.
idx
- the index of the palette to read.public java.lang.String getPaletteName(int idx)
A scalar dataset may have multiple palettes attached to it. getPaletteName(int idx) returns the name of a specific palette identified by its index.
idx
- the index of the palette to retrieve the name.
public abstract byte[] getPaletteRefs()
A palette reference is an object reference that points to the palette dataset.
For example, Dataset "Iceberg" has an attribute of object reference "Palette". The arrtibute "Palette" has value "2538" that is the object reference of the palette data set "Iceberg Palette".
public final boolean isImage()
For all Images, they must have an attribute called "CLASS". The value of this attribute is "IMAGE". For more details, read HDF5 Image and Palette Specification
public final boolean isImageDisplay()
A ScalarDS can be displayed as an image or table.
public final boolean isDefaultImageOrder()
A ScalarDS can be displayed as an image with different orders of dimensions.
public final void setIsImageDisplay(boolean b)
b
- if b is true, display the dataset as an imagepublic final void setIsImage(boolean b)
b
- if b is true, the dataset is an image.public final boolean isTrueColor()
public final boolean isText()
public final int getInterlace()
INTERLACE_PIXEL -- RGB components are contiguous, i.e. rgb, rgb, rgb, ... INTERLACE_LINE -- each RGB component is stored as a scan line INTERLACE_PLANE -- each RGB component is stored as a plane
public final boolean isUnsigned()
public double[] getImageDataRange()
public final java.lang.Object getFillValue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |