Isis Developer Reference
|
Base class for accessing ISIS blobs. More...
#include <Blobber.h>
Public Member Functions | |
Blobber () | |
Default basic constructor that is mostly not useful. More... | |
Blobber (const QString &blobname, const QString &fieldname, const QString &name="Blob") | |
Name-only based constructor. More... | |
Blobber (Cube &cube, const QString &blobname, const QString &fieldname, const QString &name="Blob") | |
Constructor using an ISIS cube class. More... | |
virtual | ~Blobber () |
Destructor of this object. More... | |
Blobber | deepcopy () const |
Create a unique copy of this blob. More... | |
void | setName (const QString &name) |
Specifies the name of this class instantiation. More... | |
void | setBlobName (const QString &bname) |
Sets the name of the ISIS BLOB object that contains the data. More... | |
void | setFieldName (const QString &fname) |
Sets field name in the ISIS BLOB object that contains data. More... | |
int | size () const |
Returns the total number of elements (rows * columns) in blob. More... | |
int | Lines () const |
Number of rows or lines in the BLOB. More... | |
int | Samples () const |
Number of columns or samples in the BLOB. More... | |
QString | getName () const |
Returns the name of the BLOB given to refer to this instantiation. More... | |
QString | getBlobName () const |
Retrieves the name of the Table object. More... | |
QString | getFieldName () const |
Retreive the name of the field in the Tabel object BLOB. More... | |
double * | operator[] (int i) |
Returns the ith row/line in the BLOB that can be further referenced into samples. More... | |
double const * | operator[] (int i) const |
Returns the ith row/line in the BLOB that can be further referenced into samples. More... | |
void | load (const QString &filename) |
Loads the contents of a BLOB from a cube file. More... | |
void | load (Cube &cube) |
Loads the contents of a BLOB from a Cube object. More... | |
Protected Types | |
typedef TNT::Array2D< double > | BlobBuf |
Internal buffer uses TNT. More... | |
Protected Member Functions | |
const BlobBuf & | ref () const |
Returns a const reference to the internal buffer for ease of use to derived objects. More... | |
Base class for accessing ISIS blobs.
This class will read any ISIS BLOB and provide generalized access to its data. Developers can derive new classes that define access information in the form of names of the Isis Object and field name.
The entire contents of the field are read in and internally stored as double floating point values. All recognized ISIS special pixels are converted when read.
Note that this provides read access only. Currently, no output is performed in this implementation although it could be acheived in derived classes.
This class does not maintain persistant access to the BLOB. This means that the entire contents of the BLOB are read and stored and the interface to the ISIS BLOB is then terminated.
Below is an example using this class to access a HiRISE BLOB. It loads the BLOB, reports the number of lines and samples and then computes the mean and standard deviation using the Statistics class:
In the above example, the name of the ISIS Table (BLOB) is "HiRISE Calibration Image" and the field of interest in that table is "Calibration". Upon instantiation, the BLOB contents are read and converted to double precision floating point values.
Note that this class is reuseable and reentrant. This provides the user to specify a different cube to load the data from.
One special thing to note that assigning these objects to other object variables results in a reference to the data...it is not copied. The following illustrates this concept:
In this example, hiblob, myblob and blob2 refer to the same blob data. Changing a pixel element in one blob results in the change in all instances of the blob. To get a completely independant copy of the data, use the deepcopy() method.
|
protected |
Internal buffer uses TNT.
Isis::Blobber::Blobber | ( | ) |
Default basic constructor that is mostly not useful.
This basic constructor may only be required so that Blobbers can be used in STL constructs (as they require a default constructor)
Isis::Blobber::Blobber | ( | const QString & | blobname, |
const QString & | fieldname, | ||
const QString & | name = "Blob" |
||
) |
Name-only based constructor.
This constructor does not require an accompanying cube and allows the user to simply define the Table object and field names to establish these for multiple reads from different cubes.
[in] | blobname | (const QString&) specifies the name of the ISIS BLOB that contains the field to read the data from |
[in] | fieldname | (const QString&) specifies the name of the field in blobname to read and convert to double precision floating point data |
[in] | name | (const QString&) Associates a name of the implementors choosing that identifies an instantiation of this class |
Isis::Blobber::Blobber | ( | Cube & | cube, |
const QString & | blobname, | ||
const QString & | fieldname, | ||
const QString & | name = "Blob" |
||
) |
Constructor using an ISIS cube class.
Reads the contents of the specified field (fieldname) from an ISIS table BLOB (blobname). Upon instatiation of this class, the BLOB data is read in and converted to double precision floating point data. Upon successful return from this construtor, the data is accessble through various methods.
[in] | cube | (Cube&) Reference to an ISIS cube file that has been opened or created in the Cube object. This file is expected to contain a Table object that is named blobname and must contain a field called fieldname. |
[in] | blobname | (const QString&) specifies the name of the ISIS BLOB that contains the field to read the data from |
[in] | fieldname | (const QString&) specifies the name of the field in blobname to read and convert to double precision floating point data |
[in] | name | (const QString&) Associates a name of the implementors choosing that identifies an instantiation of this class |
References load().
|
inlinevirtual |
Destructor of this object.
Blobber Isis::Blobber::deepcopy | ( | ) | const |
Create a unique copy of this blob.
This method creates a fully new copy of this object. The default copy constructors/methods create a reference to the data read from the Table object. For example, the following code fragment will result in two Blobbers that refer to the same memory location that stores the BLOB data:
To ensure you have two unique storage areas of the BLOB data so they can change independantly, use:
|
inline |
|
inline |
Retreive the name of the field in the Tabel object BLOB.
Referenced by load().
|
inline |
Returns the name of the BLOB given to refer to this instantiation.
|
inline |
void Isis::Blobber::load | ( | const QString & | filename | ) |
Loads the contents of a BLOB from a cube file.
Provides the I/O interface for ISIS cube files.
[in] | filename | (string&) Name of ISIS cube file to read |
References Isis::Cube::open().
Referenced by Blobber().
void Isis::Blobber::load | ( | Cube & | cube | ) |
Loads the contents of a BLOB from a Cube object.
Provides the I/O interface for the Cube object. One thing to note here is that it creates a CubeInfo object from the Cube object and then calls the CubeInfo load method. Hence, this method is required as an intermediary method that cascades to the actual method that does the real work.
[in] | cube | (Cube&) Reference to an ISIS cube file that has been opened or created in the Cube object. |
References _FILEINFO_, getBlobName(), getFieldName(), Isis::TableField::isDouble(), Isis::TableField::isInteger(), Isis::IException::Programmer, and Isis::Cube::readTable().
|
inline |
Returns the ith row/line in the BLOB that can be further referenced into samples.
To access the 2nd sample in the 10th line use:
i | Index |
|
inline |
Returns the ith row/line in the BLOB that can be further referenced into samples.
This method provides const access to the data in row matrix form. To access the 2nd sample in the 10th line use:
i | Index |
|
inlineprotected |
Returns a const reference to the internal buffer for ease of use to derived objects.
Referenced by Isis::HiBlob::buffer().
|
inline |
Number of columns or samples in the BLOB.
Referenced by size().
|
inline |
|
inline |
Sets field name in the ISIS BLOB object that contains data.
This method sets the name of the field contained within the Table object BLOB from which the data is extracted.
fname | Field name |
|
inline |
Specifies the name of this class instantiation.
This is just an additional name that can be used to identify instantiations of this class. It provides a way to uniquely identify each object.
name | Unique name |
|
inline |