- All Implemented Interfaces:
- DataFormat,- MetaDataContainer,- Serializable
public class FitsDataset extends ScalarDS
The library predefines a modest number of datatypes. For details, read The Datatype Interface (H5T)
- Version:
- 1.1 9/4/2007
- Author:
- Peter X. Cao
- See Also:
- Serialized Form
- 
Field SummaryFields inherited from class hdf.object.ScalarDSfillValue, imageDataRange, interlace, INTERLACE_LINE, INTERLACE_PIXEL, INTERLACE_PLANE, isDefaultImageOrder, isFillValueConverted, isImage, isImageDisplay, isText, isTrueColor, palette, unsignedConvertedFields 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 SummaryConstructors Constructor Description FitsDataset(FileFormat fileFormat, nom.tam.fits.BasicHDU hdu, String dName, long[] oid)Constructs an FitsDataset object with specific netcdf variable.
- 
Method SummaryModifier and Type Method Description voidclose(long did)Closes access to the object.Datasetcopy(Group pgroup, String dstName, long[] dims, Object buff)Creates a new dataset and writes the data buffer to the new dataset.static FitsDatasetcreate(String name, Group pgroup, Datatype type, long[] dims, long[] maxdims, long[] chunks, int gzip, Object data)Creates a new dataset.DatatypegetDatatype()Returns the datatype of the data object.ListgetMetadata()Retrieves the object's metadata, such as attributes, from the file.ListgetMetadata(int... attrPropList)byte[][]getPalette()Returns the palette of this scalar dataset or null if palette does not exist.byte[]getPaletteRefs()Returns the byte array of palette refs.booleanhasAttribute()Check if the object has any attributes attached.voidinit()longopen()Opens an existing object such as a dataset or group for access.Objectread()Reads the data from file.byte[]readBytes()Reads the raw data of the dataset from file to a byte array.byte[][]readPalette(int idx)Reads a specific image palette from file.voidremoveMetadata(Object info)Deletes an existing piece of metadata from this object.voidsetName(String newName)Sets the name of the object.voidupdateMetadata(Object info)Updates an existing piece of metadata attached to this object.voidwrite(Object buf)Writes a memory buffer to the object in the file.voidwriteMetadata(Object info)Writes a specific piece of metadata (such as an attribute) into the file.Methods inherited from class hdf.object.ScalarDSaddFilteredImageValue, clearData, convertFromUnsignedC, convertToUnsignedC, getFillValue, getFilteredImageValues, getImageDataRange, getInterlace, getPaletteName, isDefaultImageOrder, isImage, isImageDisplay, isTrueColor, setImageDataRange, setIsImage, setIsImageDisplay, setPaletteMethods inherited from class hdf.object.DatasetbyteToString, clear, convertFromUnsignedC, convertFromUnsignedC, convertToUnsignedC, convertToUnsignedC, getChunkSize, getCompression, getConvertByteToString, getData, getDimNames, getDims, getFilters, getHeight, getMaxDims, getOriginalClass, getRank, getSelectedDims, getSelectedIndex, getSize, getStartDims, getStorage, getStorageLayout, getStride, getVirtualFilename, getVirtualMaps, getWidth, isInited, isString, isVirtual, setConvertByteToString, setData, stringToByte, writeMethods inherited from class hdf.object.HObjectcreateFullname, debug, equals, equals, equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, hashCode, setFullname, setLinkTargetObjName, setPath, toStringMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
- 
Constructor Details- 
FitsDatasetConstructs an FitsDataset object with specific netcdf variable.- Parameters:
- fileFormat- the netcdf file.
- hdu- the BasicHDU.
- dName- the name for this dataset.
- oid- the unique identifier for this dataset.
 
 
- 
- 
Method Details- 
hasAttributeDescription copied from interface:MetaDataContainerCheck if the object has any attributes attached.- Returns:
- true if it has any attributes, false otherwise.
 
- 
copyDescription copied from class:DatasetCreates a new dataset and writes the data buffer to the new dataset.This function allows applications to create a new dataset for a given data buffer. For example, users can select a specific interesting part from a large image and create a new image with the selection. The new dataset retains the datatype and dataset creation properties of this dataset. - Specified by:
- copyin class- Dataset
- Parameters:
- pgroup- the group which the dataset is copied to.
- dstName- the name of the new dataset.
- dims- the dimension sizes of the the new dataset.
- buff- the data values of the subset to be copied.
- Returns:
- the new dataset.
- Throws:
- Exception- if dataset can not be copied
 
- 
readBytesDescription copied from class:DatasetReads the raw data of the dataset from file to a byte array.readBytes() reads raw data to an array of bytes instead of array of its datatype. For example, for a one-dimension 32-bit integer dataset of size 5, readBytes() returns a byte array of size 20 instead of an int array of 5. readBytes() can be used to copy data from one dataset to another efficiently because the raw data is not converted to its native type, it saves memory space and CPU time. 
- 
readDescription copied from interface:DataFormatReads the data from file.read() reads the data from file to a memory buffer and returns the memory buffer. The dataset object does not hold the memory buffer. To store the memory buffer in the dataset object, one must call getData(). By default, the whole dataset is read into memory. Users can also select a subset to read. Subsetting is done in an implicit way. - Returns:
- the data read from file.
- Throws:
- Exception- if object can not be read
- See Also:
- DataFormat.getData()
 
- 
writeDescription copied from interface:DataFormatWrites a memory buffer to the object in the file.- Parameters:
- buf- the data to write
- Throws:
- Exception- if data can not be written
 
- 
getMetadataDescription copied from interface:MetaDataContainerRetrieves the object's metadata, such as attributes, from the file.Metadata, such as attributes, is stored in a List. - Returns:
- the list of metadata objects.
- Throws:
- Exception- if the metadata can not be retrieved
 
- 
writeMetadataDescription copied from interface:MetaDataContainerWrites a specific piece of metadata (such as an attribute) into the file. If an HDF(4&5) attribute exists in the file, this method updates its value. If the attribute does not exist in the file, it creates the attribute in the file and attaches it to the object. It will fail to write a new attribute to the object where an attribute with the same name already exists. To update the value of an existing attribute in the file, one needs to get the instance of the attribute by getMetadata(), change its values, then use writeMetadata() to write the value.- Parameters:
- info- the metadata to write.
- Throws:
- Exception- if the metadata can not be written
 
- 
removeMetadataDescription copied from interface:MetaDataContainerDeletes an existing piece of metadata from this object.- Parameters:
- info- the metadata to delete.
- Throws:
- Exception- if the metadata can not be removed
 
- 
updateMetadataDescription copied from interface:MetaDataContainerUpdates an existing piece of metadata attached to this object.- Parameters:
- info- the metadata to update.
- Throws:
- Exception- if the metadata can not be updated
 
- 
openDescription copied from class:HObjectOpens an existing object such as a dataset or group for access. The return value is an object identifier obtained by implementing classes such as H5.H5Dopen(). This function is needed to allow other objects to be able to access the object. For instance, H5File class uses the open() function to obtain object identifier for copyAttributes(long src_id, long dst_id) and other purposes. The open() function should be used in pair with close(long) function.- Specified by:
- openin class- HObject
- Returns:
- the object identifier if successful; otherwise returns a negative value.
- See Also:
- HObject.close(long)
 
- 
closeDescription copied from class:HObjectCloses access to the object.Sub-classes must implement this interface because different data objects have their own ways of how the data resources are closed. For example, H5Group.close() calls the hdf.hdf5lib.H5.H5Gclose() method and closes the group resource specified by the group id. 
- 
init
- 
getPaletteDescription copied from class:ScalarDSReturns 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. - Specified by:
- getPalettein class- ScalarDS
- Returns:
- the 2D palette byte array.
 
- 
readPaletteDescription copied from class:ScalarDSReads 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. - Specified by:
- readPalettein class- ScalarDS
- Parameters:
- idx- the index of the palette to read.
- Returns:
- the image palette
 
- 
createpublic static FitsDataset create(String name, Group pgroup, Datatype type, long[] dims, long[] maxdims, long[] chunks, int gzip, Object data) throws ExceptionCreates a new dataset.- Parameters:
- name- the name of the dataset to create.
- pgroup- the parent group of the new dataset.
- type- the datatype of the dataset.
- dims- the dimension size of the dataset.
- maxdims- the max dimension size of the dataset.
- chunks- the chunk size of the dataset.
- gzip- the level of the gzip compression.
- data- the array of data values.
- Returns:
- the new dataset if successful. Otherwise returns null.
- Throws:
- Exception- if there is an error
 
- 
getPaletteRefsDescription copied from class:ScalarDSReturns 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". - Specified by:
- getPaletteRefsin class- ScalarDS
- Returns:
- null if there is no palette attribute attached to this dataset.
 
- 
getDatatypeDescription copied from interface:DataFormatReturns the datatype of the data object.- Specified by:
- getDatatypein interface- DataFormat
- Overrides:
- getDatatypein class- Dataset
- Returns:
- the datatype of the data object.
 
- 
setNameDescription copied from class:HObjectSets the name of the object. setName (String newName) changes the name of the object in the file.
- 
getMetadata- Throws:
- Exception
 
 
-