|
||||||||||
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.CompoundDS
A CompoundDS is data set of compound datatypes.
A compound datatype is a collection of one or more atomic types or small arrays of such types. Each member of a compound type has a name which is unique within that type, and a datatype of that member in a compound datum. Compound datatype can be nested, i.e. members of compound datatype can be some other compound datatype.
How to Select a Subset
Dataset defines APIs for read, write and subet a dataset. No function is defined to select a subset of a data array. The selection is done in an implicit way. Function calls to dimension information such as getSelectedDims() return an array of dimension values, which is a reference to the array in the dataset object. Changes of the array outside the dataset object directly change the values of the array in the dataset object. It is like pointers in C.
The following is an example of how to make a subset. In the example, the dataset
is a 4-dimension with size of [200][100][50][10], i.e.
dims[0]=200; dims[1]=100; dims[2]=50; dims[3]=10;
We want to select every other data points in dims[1] and dims[2]
int rank = dataset.getRank(); // number of dimension of the dataset long[] dims = dataset.getDims(); // the dimension sizes of the dataset long[] selected = dataset.getSelectedDims(); // the selected size of the dataet long[] start = dataset.getStartDims(); // the off set of the selection long[] stride = dataset.getStride(); // the stride of the dataset int[] selectedIndex = dataset.getSelectedIndex(); // the selected dimensions for display // select dim1 and dim2 as 2D data for display,and slice through dim0 selectedIndex[0] = 1; selectedIndex[1] = 2; selectedIndex[1] = 0; // reset the selection arrays for (int i=0; i
- See Also:
- Serialized Form
Field Summary protected boolean[]
isMemberSelected
The array to store flags to indicate if a member is selected.protected java.lang.Object[]
memberDims
The dimension sizes of each memeber.protected java.lang.String[]
memberNames
The names of members of this compound dataset.protected int[]
memberOrders
The number of data points of each member of this compound dataset.protected int[]
memberTypes
The data types of the members of this compound dataset.protected int
numberOfMembers
The number of members of this compound dataset.
Fields inherited from class ncsa.hdf.object.Dataset chunkSize, compression, data, datatype, dimNames, dims, H5Z_FILTER_CONFIG_DECODE_ENABLED, H5Z_FILTER_CONFIG_ENCODE_ENABLED, rank, selectedDims, selectedIndex, selectedStride, startDims
Fields inherited from class ncsa.hdf.object.HObject hasAttribute, oid, separator
Constructor Summary CompoundDS(FileFormat fileFormat, java.lang.String name, java.lang.String path)
CompoundDS(FileFormat fileFormat, java.lang.String name, java.lang.String path, long[] oid)
Constructs a CompoundDS object with given file and dataset name and path.
Method Summary int
getMemberCount()
Returns the number of members of this compound dataset.java.lang.String[]
getMemberNames()
Returns the names of the members of the datasetsint[]
getMemberOrders()
Returns the data orders (total array size) of all the members of this compound dataset.int[]
getMemberTypes()
Returns the data types of the members of this compound dataset.int[]
getMemeberDims(int i)
Returns the dimension sizes of each member.int
getSelectedMemberCount()
Returns the number of selected members of this compound dataset.int[]
getSelectedMemberOrders()
Returns the data orders (total array size) of the selected members of this compound dataset.boolean
isMemberSelected(int i)
Returns true if the i-th memeber is selected.void
selectMember(int i)
select the i-th member.void
setMemberSelection(boolean isSelected)
select/deselect all members.
Methods inherited from class ncsa.hdf.object.Dataset byteToString, clearData, convertFromUnsignedC, convertToUnsignedC, copy, getChunkSize, getCompression, getData, getDatatype, getDimNames, getDims, getHeight, getRank, getSelectedDims, getSelectedIndex, getStartDims, getStride, getWidth, init, read, readBytes, setData, stringToByte, write, write
Methods inherited from class ncsa.hdf.object.HObject close, equalsOID, getFID, getFile, getFileFormat, getName, getOID, getPath, hasAttribute, open, setName, setPath, toString
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ncsa.hdf.object.DataFormat getMetadata, removeMetadata, writeMetadata
Field Detail numberOfMembers
protected int numberOfMembers
- The number of members of this compound dataset.
memberNames
protected java.lang.String[] memberNames
- The names of members of this compound dataset.
memberTypes
protected int[] memberTypes
- The data types of the members of this compound dataset.
memberOrders
protected int[] memberOrders
- The number of data points of each member of this compound dataset. A member can be an array of atomic or compound data. The member order is the total size of the array. For scalar data, the member order is one.
memberDims
protected java.lang.Object[] memberDims
- The dimension sizes of each memeber.
isMemberSelected
protected boolean[] isMemberSelected
- The array to store flags to indicate if a member is selected. If a member is selected, the read/wirte will perform on the member. Applications such as HDFView will only display the selected members of the compound dataset.
For example, if a compound dataset has four members String[] memberNames = {"X", "Y", "Z", "TIME"}; and boolean[] isMemberSelected = {true, false, false, true}; only members "X" and "TIME" are selected for read and write.
Constructor Detail CompoundDS
public CompoundDS(FileFormat fileFormat, java.lang.String name, java.lang.String path)
CompoundDS
public CompoundDS(FileFormat fileFormat, java.lang.String name, java.lang.String path, long[] oid)
- Constructs a CompoundDS object with given file and dataset name and path. This object is usually constructed at FileFormat.open(), which loads the file structure and object informatoin into tree structure (TreeNode). It is rarely used elsewhere.
- Parameters:
fileFormat
- the HDF file.name
- the name of this CompoundDS.path
- the full path of this CompoundDS.oid
- the unique identifier of this data object. HDF4 objects are uniquely identified by the (tag_id, ref_id) pairs, i.e. oid[0]=tag, oid[1]=ref.
HDF5 objects uniquely identified by the reference identifier, i.e. oid[0]=object_reference
Method Detail getMemberCount
public final int getMemberCount()
- Returns the number of members of this compound dataset.
getSelectedMemberCount
public final int getSelectedMemberCount()
- Returns the number of selected members of this compound dataset.
getMemberNames
public final java.lang.String[] getMemberNames()
- Returns the names of the members of the datasets
getMemberTypes
public final int[] getMemberTypes()
- Returns the data types of the members of this compound dataset. Each member of a compound dataset has its datatype. The datatype of a member can be atomic or other compound datatype.
isMemberSelected
public final boolean isMemberSelected(int i)
- Returns true if the i-th memeber is selected.
selectMember
public final void selectMember(int i)
- select the i-th member.
setMemberSelection
public final void setMemberSelection(boolean isSelected)
- select/deselect all members.
- Parameters:
isSelected
- The indicator to select or deselect all members. isSelected=true to select all members. isSelected=false to deselect all members.
getMemberOrders
public int[] getMemberOrders()
- Returns the data orders (total array size) of all the members of this compound dataset.
getSelectedMemberOrders
public int[] getSelectedMemberOrders()
- Returns the data orders (total array size) of the selected members of this compound dataset.
getMemeberDims
public int[] getMemeberDims(int i)
- Returns the dimension sizes of each member.
Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD