Dataset Class Reference
[Graphics]
Loads and holds volumetric data.
More...
#include <Dataset.hpp>
List of all members.
Detailed Description
Loads and holds volumetric data.
In most cases, the user is only concerned with getting values from the data.
To get one value, use one of the getAs
methods. However, you should use getType()
to determine which one to call first since they will throw an exception if it doesn't match the dataset's type. We suggest using a switch statement for this purpose.
Of course, some purposes will need an actual pointer to all of the data, such as using the dataset as an OpenGL texture. In that case, use getData()
and getType()
.
Constructor & Destructor Documentation
Creates a new Dataset from a file.
- Parameters:
-
[in] | filename | Path to the file containing the data. |
Member Function Documentation
void checkIndex |
( |
const Index & |
index |
) |
const [protected] |
Makes sure that an index is in bounds.
- Parameters:
-
[in] | index | Integer coordinates specifying the location in dataset. |
- Exceptions:
-
char * findPointerTo |
( |
const Index & |
I |
) |
const |
Finds a position in the array.
- Parameters:
-
[in] | I | Integer coordinates specifying the location in dataset. |
void get |
( |
const Index & |
index, |
|
|
void *& |
value | |
|
) |
| | const [protected] |
Gets the value of an element in the data.
To dereference the pointer properly, use getType().
- Parameters:
-
[in] | index | Integer coordinates specifying the location in dataset. |
[out] | value | Pointer to the value that will be set. |
- Note:
- We don't make this method public because it has the potential to change the data. (Even though it is declared const.)
unsigned char getAsByte |
( |
const Index & |
I |
) |
const |
Gets the value of an element in the data.
- Parameters:
-
[in] | I | Integer coordinates specifying the location in dataset. |
- Exceptions:
-
| Exception | if the dataset's type is not GL_UNSIGNED_BYTE. |
- Returns:
- Copy of the value as an unsigned byte.
- Note:
- Remember if you want to print the value, cast it to an
int
first.
float getAsFloat |
( |
const Index & |
I |
) |
const |
Gets the value of an element in the data.
- Parameters:
-
[in] | I | Integer coordinates specifying the location in dataset. |
- Exceptions:
-
| Exception | if the dataset's type is not GL_FLOAT. |
- Returns:
- Copy of the value as a float.
short getAsShort |
( |
const Index & |
I |
) |
const |
Gets the value of an element in the data.
- Parameters:
-
[in] | I | Integer coordinates specifying the location in dataset. |
- Exceptions:
-
| Exception | if the dataset's type is not GL_SHORT. |
- Returns:
- Copy of the value as a short.
unsigned short getAsUnsignedShort |
( |
const Index & |
I |
) |
const |
Gets the value of an element in the data.
- Parameters:
-
[in] | I | Integer coordinates specifying the location in dataset. |
- Exceptions:
-
| Exception | if the dataset's type is not GL_SHORT. |
- Returns:
- Copy of the value as a short.
int getBlock |
( |
|
) |
const [inline] |
- Returns:
- Number of bytes in one sample.
void * getData |
( |
|
) |
[inline] |
- Returns:
- Pointer to the start of all the data.
int getDepth |
( |
|
) |
const [inline] |
- Returns:
- Number of samples in the Z direction.
string getFilename |
( |
|
) |
const [inline] |
- Returns:
- Path to the file the dataset was loaded from.
GLint getFootprint |
( |
|
) |
const [inline] |
- Returns:
- Size in memory of the data.
- Returns:
- Header as read from the file.
int getHeight |
( |
|
) |
const [inline] |
- Returns:
- Number of samples in the Y direction.
int getHigh |
( |
|
) |
const [inline] |
- Returns:
- Highest value according to the header.
int getLength |
( |
|
) |
const [inline] |
- Returns:
- Number of total samples in the dataset.
int getLow |
( |
|
) |
const [inline] |
- Returns:
- Lowest value according to the header.
int getMax |
( |
|
) |
const [inline] |
- Returns:
- Maximum possible value according to the header.
int getMaximumDimension |
( |
|
) |
const |
int getMin |
( |
|
) |
const [inline] |
- Returns:
- Minimum possible value according to the header.
GLenum getType |
( |
|
) |
const [inline] |
Currently, the return value will be one of
GL_UNSIGNED_BYTE
,
GL_SHORT
, or
GL_UNSIGNED_SHORT
, or
GL_FLOAT
,
which can then be used in a switch
statement.
- Returns:
- Enumeration representing the type of the data.
int getWidth |
( |
|
) |
const [inline] |
- Returns:
- Number of samples in the X direction.
void initDimensions |
( |
|
) |
[protected] |
void initTypeBlock |
( |
|
) |
[protected] |
void print |
( |
Index |
index |
) |
|
Prints a value in the dataset.
- Parameters:
-
[in] | index | Integer coordinates specifying the location in dataset. |
void print |
( |
|
) |
const [inline] |
Prints the header of the dataset.
void readData |
( |
|
) |
[protected] |
Reads the data from the file into the data array.
void set |
( |
const Index & |
index, |
|
|
const void * |
value, |
|
|
GLenum |
type | |
|
) |
| | |
Sets a sample in the dataset.
- Parameters:
-
[in] | index | Index specifying the location of the sample. |
[in] | value | Pointer to the value that the sample will be set to. |
[in] | type | Type of the value to set. |
- Exceptions:
-
| const_char* | if the type passed does not match. |
- See also:
- getType()
The documentation for this class was generated from the following files: