- All Implemented Interfaces:
- DataFormat,- MetaDataContainer,- Serializable
- Direct Known Subclasses:
- FitsDataset,- H4GRImage,- H4SDS,- H5ScalarDS,- NC2Dataset
A ScalarDS can be an image or spreadsheet data. ScalarDS defines methods to deal with both images and spreadsheets.
ScalarDS is an abstract class. Current implementing classes are the H4SDS, H5GRImage and H5ScalarDS.
- Version:
- 1.1 9/4/2007
- Author:
- Peter X. Cao
- See Also:
- Serialized Form
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ObjectThe fill value of the dataset.protected double[]The min-max range of image data values.protected intThe interlace mode of the stored raster image data.static intIndicates that each pixel component of RGB is stored as a scan line.static intIndicates that the pixel RGB values are contiguous.static intIndicates that each pixel component of RGB is stored as a plane.protected booleanFlag to indicate if the dataset is displayed as an image with default order of dimensions.booleanFlag to indicate if the FillValue is converted from unsigned C.protected booleanTrue if this dataset is an image.protected booleanFlag to indicate if the dataset is displayed as an image.protected booleanTrue if this dataset is ASCII text.protected booleanTrue if this dataset is a true color image.protected byte[][]The indexed RGB color model with 256 colors.protected booleanFlag to indicate is the original unsigned C data is converted.Fields inherited from class hdf.object.DatasetchunkSize, compression, COMPRESSION_GZIP_TXT, convertByteToString, convertedBuf, data, datatype, dimNames, dims, filters, inited, isDataLoaded, maxDims, nPoints, originalBuf, rank, selectedDims, selectedIndex, selectedStride, startDims, storage, storageLayoutFields inherited from class hdf.object.HObjectfileFormat, linkTargetObjName, oid, SEPARATOR
- 
Constructor SummaryConstructorsConstructorDescriptionScalarDS(FileFormat theFile, String theName, String thePath)Constructs an instance of a ScalarDS with specific name and path.ScalarDS(FileFormat theFile, String theName, String thePath, long[] oid)Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a value that will be filtered out in an image.voidClears the current data buffer in memory and forces the next read() to load the data from file.Converts the data values of this dataset to appropriate Java integer if they are unsigned integers.Converts Java integer data of this dataset back to unsigned C-type integer data if they are unsigned integers.Returns the fill values for the dataset.Get a list of values that will be filtered out in an image.double[]Returns the (min, max) pair of image data range.intReturns the interlace mode of a true color image (RGB).abstract byte[][]Returns the palette of this scalar dataset or null if palette does not exist.getPaletteName(int idx)Get the name of a specific image palette from file.abstract byte[]Returns the byte array of palette refs.booleanReturns true if this dataset is displayed as an image with default image order.booleanisImage()Returns true if this dataset is an image.booleanReturns true if this dataset is displayed as an image.booleanabstract byte[][]readPalette(int idx)Reads a specific image palette from file.voidsetImageDataRange(double min, double max)Sets data range for an image.voidsetIsImage(boolean b)Sets the flag to indicate this dataset is an image.voidsetIsImageDisplay(boolean b)Sets the flag to display the dataset as an image.voidsetPalette(byte[][] pal)Sets the palette for this dataset.Methods inherited from class hdf.object.DatasetbyteToString, clear, convertFromUnsignedC, convertFromUnsignedC, convertToUnsignedC, convertToUnsignedC, copy, getChunkSize, getCompression, getConvertByteToString, getData, getDatatype, getDimNames, getDims, getFilters, getHeight, getMaxDims, getOriginalClass, getRank, getSelectedDims, getSelectedIndex, getSize, getStartDims, getStorage, getStorageLayout, getStride, getVirtualFilename, getVirtualMaps, getWidth, isInited, isString, isVirtual, readBytes, setConvertByteToString, setData, stringToByte, writeMethods inherited from class hdf.object.HObjectclose, createFullname, debug, equals, equals, equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, hashCode, open, setFullname, setLinkTargetObjName, setName, setPath, toStringMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface hdf.object.DataFormatinit, read, writeMethods inherited from interface hdf.object.MetaDataContainergetMetadata, hasAttribute, removeMetadata, updateMetadata, writeMetadata
- 
Field Details- 
INTERLACE_PIXELIndicates that the pixel RGB values are contiguous.- See Also:
- Constant Field Values
 
- 
INTERLACE_LINEIndicates that each pixel component of RGB is stored as a scan line.- See Also:
- Constant Field Values
 
- 
INTERLACE_PLANEIndicates that each pixel component of RGB is stored as a plane.- See Also:
- Constant Field Values
 
- 
interlaceThe interlace mode of the stored raster image data. Valid values are INTERLACE_PIXEL, INTERLACE_LINE and INTERLACE_PLANE.
- 
imageDataRangeThe min-max range of image data values. For example, [0, 255] indicates the min is 0, and the max is 255.
- 
paletteThe indexed RGB color model with 256 colors.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. 
- 
isImageTrue if this dataset is an image.
- 
isTrueColorTrue if this dataset is a true color image.
- 
isTextTrue if this dataset is ASCII text.
- 
unsignedConvertedFlag to indicate is the original unsigned C data is converted.
- 
fillValueThe fill value of the dataset.
- 
isImageDisplayFlag to indicate if the dataset is displayed as an image.
- 
isDefaultImageOrderFlag to indicate if the dataset is displayed as an image with default order of dimensions.
- 
isFillValueConvertedFlag to indicate if the FillValue is converted from unsigned C.
 
- 
- 
Constructor Details- 
ScalarDSConstructs an instance of a ScalarDS with specific name and path. An HDF data object must have a name. The path is the group path starting from the root.For example, in H5ScalarDS(h5file, "dset", "/arrays/"), "dset" is the name of the dataset, "/arrays" is the group path of the dataset. - Parameters:
- 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/".
 
- 
ScalarDSDeprecated.Not for public use in the future.
 UsingScalarDS(FileFormat, String, String)- Parameters:
- 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/".
- oid- the v of the data object.
 
 
- 
- 
Method Details- 
clearDataDescription copied from class:DatasetClears the current data buffer in memory and forces the next read() to load the data from file.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. - Specified by:
- clearDatain interface- DataFormat
- Overrides:
- clearDatain class- Dataset
- See Also:
- Dataset.getData(),- DataFormat.read()
 
- 
convertFromUnsignedCConverts the data values of this dataset to appropriate Java integer if they are unsigned integers.- Returns:
- the converted data buffer.
- See Also:
- Dataset.convertToUnsignedC(Object),- Dataset.convertFromUnsignedC(Object, Object)
 
- 
convertToUnsignedCConverts Java integer data of this dataset back to unsigned C-type integer data if they are unsigned integers.- Returns:
- the converted data buffer.
- See Also:
- Dataset.convertToUnsignedC(Object),- Dataset.convertToUnsignedC(Object, Object),- Dataset.convertFromUnsignedC(Object data_in)
 
- 
getPaletteReturns the palette of this scalar dataset or null if palette does not exist.A Scalar dataset can be displayed as spreadsheet data or an image. When a scalar dataset is displayed 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 is not loaded, this interface retrieves the palette from the file and returns the palette. If the palette is loaded, it returns the palette. It returns null if there is no palette associated 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 are arranges 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. - Returns:
- the 2D palette byte array.
 
- 
setPaletteSets the palette for this dataset.- Parameters:
- pal- the 2D palette byte array.
 
- 
readPaletteReads a specific image palette from file.A scalar dataset may have multiple palettes attached to it. readPalette(int idx) returns a specific palette identified by its index. - Parameters:
- idx- the index of the palette to read.
- Returns:
- the image palette
 
- 
getPaletteNameGet the name of a specific image palette from file.A scalar dataset may have multiple palettes attached to it. getPaletteName(int idx) returns the name of a specific palette identified by its index. - Parameters:
- idx- the index of the palette to retrieve the name.
- Returns:
- The name of the palette
 
- 
getPaletteRefsReturns the byte array of palette refs.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". - Returns:
- null if there is no palette attribute attached to this dataset.
 
- 
isImageReturns true if this dataset is an image.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 - Returns:
- true if the dataset is an image; otherwise, returns false.
 
- 
isImageDisplayReturns true if this dataset is displayed as an image.A ScalarDS can be displayed as an image or a spreadsheet in a table. - Returns:
- true if this dataset is displayed as an image; otherwise, returns false.
 
- 
isDefaultImageOrderReturns true if this dataset is displayed as an image with default image order.A ScalarDS can be displayed as an image with different orders of dimensions. - Returns:
- true if this dataset is displayed as an image with default image order; otherwise, returns false.
 
- 
setIsImageDisplaySets the flag to display the dataset as an image.- Parameters:
- b- if b is true, display the dataset as an image
 
- 
setIsImageSets the flag to indicate this dataset is an image.- Parameters:
- b- if b is true, the dataset is an image.
 
- 
setImageDataRangeSets data range for an image.- Parameters:
- min- the data range start.
- max- the data range end.
 
- 
addFilteredImageValueAdd a value that will be filtered out in an image.- Parameters:
- x- value to be filtered
 
- 
getFilteredImageValuesGet a list of values that will be filtered out in an image.- Returns:
- the list of Image values
 
- 
isTrueColor- Returns:
- true if this dataset is a true color image.
 
- 
getInterlaceReturns the interlace mode of a true color image (RGB). Valid values: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- Returns:
- the interlace mode of a true color image (RGB).
 
- 
getImageDataRangeReturns the (min, max) pair of image data range.- Returns:
- the (min, max) pair of image data range.
 
- 
getFillValueReturns the fill values for the dataset.- Returns:
- the fill values for the dataset.
 
 
- 
Using
ScalarDS(FileFormat, String, String)