Isis Developer Reference
Isis::Cube Class Reference

IO Handler for Isis Cubes. More...

#include <Cube.h>

Collaboration diagram for Isis::Cube:
Collaboration graph

Public Types

enum  Format { Bsq , Tile }
 These are the possible storage formats of ISIS cubes. More...
 

Public Member Functions

 Cube ()
 Constructs a Cube object.
 
 Cube (const FileName &fileName, QString access="r")
 Construct a cube and open it for reading or reading/writing.
 
virtual ~Cube ()
 Destroys the Cube object.
 
void fromIsd (const FileName &fileName, Pvl &label, nlohmann::json &isd, QString access)
 Initialize Cube data from a PVL label and JSON ISD.
 
void fromIsd (const FileName &fileName, FileName &labelFile, FileName &isdFile, QString access)
 Initialize Cube data from a PVL label and JSON ISD.
 
void fromLabel (const FileName &fileName, Pvl &label, QString access)
 Initialize Cube data from a PVL label.
 
bool isOpen () const
 Test if a cube file has been opened/created.
 
bool isProjected () const
 Returns true if the labels of the cube appear to have a valid mapping group.
 
bool isReadOnly () const
 Test if the opened cube is read-only, that is write operations will fail if this is true.
 
bool isReadWrite () const
 Test if the opened cube is read-write, that is read and write operations should succeed if this is true.
 
bool labelsAttached () const
 Test if labels are attached.
 
void attachSpiceFromIsd (nlohmann::json Isd)
 
void close (bool remove=false)
 Closes the cube and updates the labels.
 
Cubecopy (FileName newFile, const CubeAttributeOutput &newFileAttributes)
 Copies the cube to the new fileName.
 
void create (const QString &cfile)
 This method will create an isis cube for writing.
 
void create (const QString &cfile, const CubeAttributeOutput &att)
 This method will create an isis cube for writing.
 
void open (const QString &cfile, QString access="r")
 This method will open an existing isis cube for reading or reading/writing.
 
void reopen (QString access="r")
 This method will reopen an isis sube for reading or reading/writing.
 
void read (Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
 This method will read data from the specified Blob object.
 
void read (Buffer &rbuf) const
 This method will read a buffer of data from the cube as specified by the contents of the Buffer object.
 
OriginalLabel readOriginalLabel (const QString &name="IsisCube") const
 Read the original PDS3 label from a cube.
 
CubeStretch readCubeStretch (QString name="CubeStretch", const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
 Read a Stretch from a cube.
 
OriginalXmlLabel readOriginalXmlLabel () const
 Read the original PDS4 label from a cube.
 
History readHistory (const QString &name="IsisCube") const
 Read the History from the Cube.
 
ImagePolygon readFootprint () const
 Read the footprint polygon for the Cube.
 
Table readTable (const QString &name)
 Read a Table from the cube.
 
void write (Blob &blob, bool overwrite=true)
 This method will write a blob of data (e.g.
 
void write (const Table &table)
 Write a Table to the Cube.
 
void write (const CubeStretch &cubeStretch)
 Write a Stretch to the Cube.
 
void write (OriginalLabel &lab)
 This method will write an OriginalLabel object.
 
void write (const OriginalXmlLabel &lab)
 This method will write an OriginalXmlLabel object.
 
void write (History &history, const QString &name="IsisCube")
 Write an updated History to the Cube.
 
void write (const ImagePolygon &polygon)
 Write a polygon to the Cube.
 
void write (Buffer &wbuf)
 This method will write a buffer of data from the cube as specified by the contents of the Buffer object.
 
void setBaseMultiplier (double base, double mult)
 Used prior to the Create method, this will specify the base and multiplier for converting 8-bit/16-bit back and forth between 32-bit:
 
void setMinMax (double min, double max)
 Used prior to the Create method, this will compute a good base and multiplier value given the minimum/maximum range of the 32bit data.
 
void setByteOrder (ByteOrder byteOrder)
 Used prior to the Create method, this will specify the byte order of pixels, either least or most significant byte.
 
void setDimensions (int ns, int nl, int nb)
 Used prior to the Create method to specify the size of the cube.
 
void setExternalDnData (FileName cubeFileWithDnData)
 Used to set external dn data to cube.
 
void setFormat (Format format)
 Used prior to the Create method, this will specify the format of the cube, either band, sequential or tiled.
 
void setLabelsAttached (bool attached)
 Use prior to calling create, this sets whether or not to use separate label and data files.
 
void setLabelSize (int labelBytes)
 Used prior to the Create method, this will allocate a specific number of bytes in the label area for attached files.
 
void setPixelType (PixelType pixelType)
 Used prior to the Create method, this will specify the output pixel type.
 
void setVirtualBands (const QList< QString > &vbands)
 This allows the programmer to specify a subset of bands to work with.
 
void setVirtualBands (const std::vector< QString > &vbands)
 This is a deprecated version of setVirtualBands(const QList<QString> &).
 
void relocateDnData (FileName dnDataFile)
 Relocates the DN data for a cube to an external cube label file.
 
virtual int bandCount () const
 Returns the number of virtual bands for the cube.
 
double base () const
 Returns the base value for converting 8-bit/16-bit pixels to 32-bit.
 
ByteOrder byteOrder () const
 Returns the byte order/endian-ness of the cube file.
 
Cameracamera ()
 Return a camera associated with the cube.
 
FileName externalCubeFileName () const
 If this is an external cube label file, this will give you the cube dn file that this label references.
 
virtual QString fileName () const
 Returns the opened cube's filename.
 
Format format () const
 
virtual Histogramhistogram (const int &band=1, QString msg="Gathering histogram")
 This method returns a pointer to a Histogram object which allows the program to obtain and use various statistics and histogram information from the cube.
 
virtual Histogramhistogram (const int &band, const double &validMin, const double &validMax, QString msg="Gathering histogram")
 This method returns a pointer to a Histogram object which allows the program to obtain and use various statistics and histogram information from the cube.
 
Pvllabel () const
 Returns a pointer to the IsisLabel object associated with the cube.
 
int labelSize (bool actual=false) const
 Returns the number of bytes used by the label.
 
int lineCount () const
 
double multiplier () const
 Returns the multiplier value for converting 8-bit/16-bit pixels to 32-bit.
 
PixelType pixelType () const
 
virtual int physicalBand (const int &virtualBand) const
 This method will return the physical band number given a virtual band number.
 
Projectionprojection ()
 
int sampleCount () const
 
Statisticsstatistics (const int &band=1, QString msg="Gathering statistics")
 This method returns a pointer to a Statistics object which allows the program to obtain and use various statistics from the cube.
 
Statisticsstatistics (const int &band, const double &validMin, const double &validMax, QString msg="Gathering statistics")
 This method returns a pointer to a Statistics object which allows the program to obtain and use various statistics from the cube.
 
bool storesDnData () const
 This method returns a boolean value.
 
void addCachingAlgorithm (CubeCachingAlgorithm *)
 This will add the given caching algorithm to the list of attempted caching algorithms.
 
void clearIoCache ()
 This will clear excess RAM used for quicker IO in the cube.
 
bool deleteBlob (QString BlobName, QString BlobType)
 This method will delete a blob label object from the cube as specified by the Blob type and name.
 
void deleteGroup (const QString &group)
 Deletes a group from the cube labels.
 
PvlGroupgroup (const QString &group) const
 Read a group from the cube into a Label.
 
bool hasGroup (const QString &group) const
 Return if the cube has a specified group in the labels.
 
bool hasTable (const QString &name)
 Check to see if the cube contains a pvl table by the provided name.
 
bool hasBlob (const QString &name, const QString &type)
 Check to see if the cube contains a BLOB.
 
void putGroup (const PvlGroup &group)
 Adds a group in a Label to the cube.
 
void latLonRange (double &minLatitude, double &maxLatitude, double &minLongitude, double &maxLongitude)
 Returns the latitude and longitude range for the Cube.
 

Detailed Description

IO Handler for Isis Cubes.

This class is used to open, create, read, and write data from Isis cube files.

Author
2003-02-14 Jeff Anderson

Member Enumeration Documentation

◆ Format

These are the possible storage formats of ISIS cubes.

There is an internal IO handler for each one of these.

Enumerator
Bsq 

Cubes are stored in band-sequential format, that is the order of the pixels in the file (on disk) is:

    S1,L1,B1
    S2,L1,B1
    and so on until ...
    SN,L1,B1
    S1,L2,B1
    and so on until ...
    S1,LN,B1
    S1,L1,B2
    S2,L1,B2
    and so on until ...
    S1,L1,BN
  

The idea is the cubes are stored left-to-right, top-to-bottom, then front-to-back.

Tile 

Cubes are stored in tile format, that is the order of the pixels in the file (on disk) is BSQ within a given sub-area defined by the Tile IO handler.

Typically these tiles are around 1MB for efficiency.

The idea is the cubes are stored left-to-right, top-to-bottom inside the tiles (which have 1 band). The tiles are themselves in BSQ order also. Please note that this can cause cubes to be larger on disk due to the tile size not being evenly divisible into the cube size.

Cube:

------------------------------
|Tile *Tile *Tile *Tile *Tile|*
|  0  *  1  *  2  *  3  *  4 |*
|     *     *     *     *    |*
|****************************|*
|Tile *Tile *Tile *Tile *Tile|*
|  5  *  6  *  7  *  8  *  9 |*
|     *     *     *     *    |*
|****************************|*
|Tile *Tile *Tile *Tile *Tile|*
------------------------------*
* 10  * 11  * 12  * 13  * 14  *
*******************************

The symbol '*' denotes tile boundaries. The symbols '-' and '|' denote cube boundaries.

Constructor & Destructor Documentation

◆ Cube() [1/2]

Isis::Cube::Cube ( )

Constructs a Cube object.

Referenced by copy().

◆ Cube() [2/2]

Isis::Cube::Cube ( const FileName & fileName,
QString access = "r" )

Construct a cube and open it for reading or reading/writing.

Parameters
fileNameName of the cube file to open. Environment variables in the filename will be automatically expanded.
accessDefines how the cube will be opened. Either read-only "r" or read-write "rw".

References fileName(), and open().

◆ ~Cube()

Isis::Cube::~Cube ( )
virtual

Destroys the Cube object.

References close().

Member Function Documentation

◆ addCachingAlgorithm()

void Isis::Cube::addCachingAlgorithm ( CubeCachingAlgorithm * algorithm)

This will add the given caching algorithm to the list of attempted caching algorithms.

The algorithms are tried in the opposite order that they were added - the first algorithm added is the last algorithm tried.

RegionalCachingAlgorithm is the only initial caching algorithm and works well for most cases. The caching algorithm only apply to the opened Cube and is reset by any changes to the open status of the Cube.

This method takes ownership of algorithm.

Parameters
algorithmThe caching algorithm to add to the Cube for I/O

References _FILEINFO_, Isis::CubeIoHandler::addCachingAlgorithm(), isOpen(), and Isis::IException::Programmer.

Referenced by Isis::DemShape::DemShape(), and Isis::ProcessMapMosaic::StartProcess().

◆ attachSpiceFromIsd()

◆ bandCount()

◆ base()

double Isis::Cube::base ( ) const

Returns the base value for converting 8-bit/16-bit pixels to 32-bit.

\[ out = in * multiplier + base \]

Returns
double The base value for converting 8-bit/16-bit pixels to 32-bit.

Referenced by copy(), and setBaseMultiplier().

◆ byteOrder()

ByteOrder Isis::Cube::byteOrder ( ) const

Returns the byte order/endian-ness of the cube file.

Cubes in a native byte order are quicker to read/write than those who must correct their byte order.

Returns
The byte order/endian-ness of the cube file

Referenced by setByteOrder().

◆ camera()

Camera * Isis::Cube::camera ( )

Return a camera associated with the cube.

The generation of the camera can throw an exception, so you might want to catch errors if that interests you.

Returns
A camera based on the open cube

References Isis::CameraFactory::Create(), and isOpen().

Referenced by attachSpiceFromIsd(), Isis::CameraStatistics::CameraStatistics(), Isis::ImagePolygon::initCube(), Isis::JigsawSetupDialog::JigsawSetupDialog(), latLonRange(), Isis::Chip::Load(), Isis::SunShadowTool::mouseButtonPress(), Isis::PhotometricFunction::PhotometricFunction(), and Isis::CameraPointInfo::SetCube().

◆ clearIoCache()

void Isis::Cube::clearIoCache ( )

This will clear excess RAM used for quicker IO in the cube.

This should only be called if you need hundreds of cubes opened simultaneously. The IO cache will start growing again on future IO's.

References Isis::CubeIoHandler::clearCache().

◆ close()

void Isis::Cube::close ( bool removeIt = false)

Closes the cube and updates the labels.

Optionally, it deletes the cube if requested.

Parameters
removeIt(Default value = false) Indicates if the file should be removed/deleted.

References isOpen(), and isReadWrite().

Referenced by Isis::ProcessMosaic::EndProcess(), Isis::ImageOverlapSet::FindImageOverlaps(), fromIsd(), fromLabel(), Isis::Process::PropagateTables(), reopen(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessMosaic::StartProcess(), ~Cube(), and Isis::ProcessMosaic::~ProcessMosaic().

◆ copy()

◆ create() [1/2]

void Isis::Cube::create ( const QString & cubeFileName)

This method will create an isis cube for writing.

The programmer should make appropriate calls to Set methods before invoking Create. If none are made there are internal defaults which are:

Dimensions 512x512x1
ByteOrder Matches architecture of host machine
Attached From user preference file
Label Size 65536 bytes
Format Tiled
Base 0.0
Multiplier 1.0
Format
These are the possible storage formats of ISIS cubes.
Definition Cube.h:179
ByteOrder
Tests the current architecture for byte order.
Definition Endian.h:42
PixelType
Enumerations for Isis Pixel Types.
Definition PixelType.h:27
@ Real
Definition PixelType.h:35
Parameters
cubeFileNameName of the cube file to open. If the extenstion ".cub" is not given it will be appended (i.e., the extension of .cub is forced). Environment variables in the filename will be automatically expanded as well.

References _FILEINFO_, Isis::PvlObject::addObject(), Bsq, Isis::ByteOrderName(), Isis::FileName::expanded(), Isis::IException::Io, isOpen(), Isis::None, Isis::FileName::original(), Isis::PixelTypeName(), Isis::Preference::Preferences(), Isis::IException::Programmer, Isis::SizeOf(), Isis::toString(), Isis::IException::Unknown, Isis::CubeIoHandler::updateLabels(), and Isis::IException::User.

Referenced by copy(), create(), Isis::ImageImporter::createOutput(), fromLabel(), Isis::Process::SetOutputCube(), and Isis::ProcessMosaic::StartProcess().

◆ create() [2/2]

void Isis::Cube::create ( const QString & cubeFileName,
const CubeAttributeOutput & att )

This method will create an isis cube for writing.

The programmer should make appropriate calls to Set methods before invoking Create. If none are made there are internal defaults which are:

Dimensions 512x512x1
ByteOrder Matches architecture of host machine
Attached From user preference file
Label Size 65536 bytes
Format Tiled
Base 0.0
Multiplier 1.0
Parameters
cubeFileNameName of the cube file to open. If the extenstion ".cub" is not given it will be appended (i.e., the extension of .cub is forced). Environment variables in the filename will be automatically expanded as well.
attCubeAttributeOutput

References Isis::AttachedLabel, create(), setByteOrder(), setFormat(), setLabelsAttached(), setMinMax(), and setPixelType().

◆ deleteBlob()

bool Isis::Cube::deleteBlob ( QString BlobName,
QString BlobType )

This method will delete a blob label object from the cube as specified by the Blob type and name.

If blob does not exist it will do nothing and return false.

Parameters
BlobNameblob to be deleted
BlobTypetype of blob to search for (Polygon, Table, etc)
Returns
boolean if it found the blob and deleted it.

References Isis::PvlObject::deleteObject(), Isis::PvlObject::object(), and Isis::PvlObject::objects().

Referenced by Isis::ProcessMosaic::StartProcess().

◆ deleteGroup()

void Isis::Cube::deleteGroup ( const QString & group)

Deletes a group from the cube labels.

If the group does not exist nothing happens; otherwise the group is removed. This will only work on output cubes, therefore, input cubes will not be updated.

Parameters
[out]groupName of the group to delete.

References Isis::PvlObject::findObject(), group(), and label().

◆ externalCubeFileName()

FileName Isis::Cube::externalCubeFileName ( ) const

If this is an external cube label file, this will give you the cube dn file that this label references.

Returns
The cube that this external label file references

References _FILEINFO_, Isis::PvlObject::findObject(), isOpen(), storesDnData(), and Isis::IException::Unknown.

Referenced by Isis::ControlPointEditWidget::createControlPoint(), Isis::Image::deleteFromDisk(), and Isis::Shape::deleteFromDisk().

◆ fileName()

◆ format()

Cube::Format Isis::Cube::format ( ) const
Returns
the cube's storage format. If no cube is opened yet, then this is the storage format that will be used if create(...) is called.

Referenced by setFormat().

◆ fromIsd() [1/2]

void Isis::Cube::fromIsd ( const FileName & fileName,
FileName & labelFile,
FileName & isdFile,
QString access )

Initialize Cube data from a PVL label and JSON ISD.

Parameters
fileNameName of the cube file to open. Environment variables in the filename will be automatically expanded.
labelFilePath to PVL label representing the new Cube label
isdPathPath to Ale compatible ISD
accessDefines how the cube will be opened. Either read-only "r" or read-write "rw".

References fileName(), fromIsd(), Isis::IException::Io, label(), and reopen().

◆ fromIsd() [2/2]

void Isis::Cube::fromIsd ( const FileName & fileName,
Pvl & label,
nlohmann::json & isd,
QString access )

Initialize Cube data from a PVL label and JSON ISD.

Parameters
fileNameName of the cube file to open. Environment variables in the filename will be automatically expanded.
labelPVL label object representing the new Cube label
isdJSON object containing Ale compatible ISD
accessDefines how the cube will be opened. Either read-only "r" or read-write "rw".

References attachSpiceFromIsd(), close(), fileName(), fromLabel(), label(), and open().

Referenced by fromIsd().

◆ fromLabel()

void Isis::Cube::fromLabel ( const FileName & fileName,
Pvl & label,
QString access )

Initialize Cube data from a PVL label.

Parameters
fileNameName of the cube file to open. Environment variables in the filename will be automatically expanded.
labelPVL label object representing the new Cube label
accessDefines how the cube will be opened. Either read-only "r" or read-write "rw".

References close(), create(), fileName(), Isis::PvlObject::findObject(), label(), open(), and putGroup().

Referenced by fromIsd().

◆ group()

PvlGroup & Isis::Cube::group ( const QString & group) const

Read a group from the cube into a Label.

If the group does not exist an exception will be thrown.

Parameters
[out]groupName of the group to get
Returns
(PvlGroup) Label which will contain the requested group.

References Isis::PvlObject::findObject(), group(), and label().

Referenced by attachSpiceFromIsd(), deleteGroup(), group(), hasGroup(), Isis::HiLab::HiLab(), Isis::HiCalData::load(), putGroup(), and Isis::CubeViewport::setTrackingCube().

◆ hasBlob()

bool Isis::Cube::hasBlob ( const QString & name,
const QString & type )

Check to see if the cube contains a BLOB.

Parameters
nameThe name of the BLOB to search for
typeThe type of the BLOB to search for
Returns
bool True if the BLOB was found

References label(), Isis::PvlObject::object(), and Isis::PvlObject::objects().

Referenced by Isis::CameraFactory::Create(), hasTable(), and Isis::Spice::Spice().

◆ hasGroup()

bool Isis::Cube::hasGroup ( const QString & group) const

Return if the cube has a specified group in the labels.

Parameters
[out]groupName of the group to check.
Returns
(bool) True if the cube has the specified group, false if not.

References Isis::PvlObject::findObject(), group(), and label().

Referenced by Isis::CubeViewport::CubeViewport(), and latLonRange().

◆ hasTable()

bool Isis::Cube::hasTable ( const QString & name)

Check to see if the cube contains a pvl table by the provided name.

Parameters
nameThe name of the pvl table to search for
Returns
bool True if the pvl table was found

References hasBlob().

Referenced by Isis::ClipperNacRollingShutterCamera::ClipperNacRollingShutterCamera().

◆ histogram() [1/2]

Histogram * Isis::Cube::histogram ( const int & band,
const double & validMin,
const double & validMax,
QString msg = "Gathering histogram" )
virtual

This method returns a pointer to a Histogram object which allows the program to obtain and use various statistics and histogram information from the cube.

Cube does not retain ownership of the returned pointer - please delete it when you are done with it.

Parameters
[in]bandReturns the histogram for the specified band. If the user specifies 0 for this parameter, the method will loop through every band in the cube and accumulate a histogram from all of them
validMinThe start of the bin range and valid data range for the histogram
validMaxThe end of the bin range and valid data range for the histogram
msgThe message to display with the percent process while gathering histogram data
Returns
(Histogram) A pointer to a Histogram object.
Exceptions
ProgrammerErrorBand was less than zero or more than the number of bands in the cube.

References _FILEINFO_, bandCount(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), isOpen(), lineCount(), Isis::IException::Programmer, read(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::Buffer::size(), Isis::ValidMaximum, and Isis::ValidMinimum.

◆ histogram() [2/2]

Histogram * Isis::Cube::histogram ( const int & band = 1,
QString msg = "Gathering histogram" )
virtual

This method returns a pointer to a Histogram object which allows the program to obtain and use various statistics and histogram information from the cube.

Cube does not retain ownership of the returned pointer - please delete it when you are done with it.

Parameters
[in]band(Default value is 1) Returns the histogram for the specified band.If the user specifies 0 for this parameter, the method will loop through every band in the cube and accumulate a histogram from all of them
msgThe message to display with the percent process while gathering histogram data
Returns
(Histogram) A pointer to a Histogram object.
Exceptions
IsisProgrammerErrorBand was less than zero or more than the number of bands in the cube.

References histogram(), Isis::ValidMaximum, and Isis::ValidMinimum.

Referenced by histogram().

◆ isOpen()

bool Isis::Cube::isOpen ( ) const

Test if a cube file has been opened/created.

Returns
True if a cube has been opened and I/O operations are allowed

References open().

Referenced by addCachingAlgorithm(), camera(), close(), copy(), create(), Isis::CubeViewport::CubeViewport(), externalCubeFileName(), fileName(), histogram(), isReadOnly(), open(), projection(), read(), read(), relocateDnData(), Isis::Process::SetInputCube(), statistics(), write(), and write().

◆ isProjected()

bool Isis::Cube::isProjected ( ) const

Returns true if the labels of the cube appear to have a valid mapping group.

This returning true does not guarantee that the cube can project or that the Projection() method will succeed.

Returns
bool True if the file should have a valid projection

References Isis::PvlObject::findObject(), and label().

◆ isReadOnly()

bool Isis::Cube::isReadOnly ( ) const

Test if the opened cube is read-only, that is write operations will fail if this is true.

A cube must be opened in order to call this method.

Returns
True if the cube is opened read-only

References _FILEINFO_, isOpen(), and Isis::IException::Programmer.

Referenced by isReadWrite(), putGroup(), and write().

◆ isReadWrite()

bool Isis::Cube::isReadWrite ( ) const

Test if the opened cube is read-write, that is read and write operations should succeed if this is true.

A cube must be opened in order to call this method.

Returns
True if the cube is opened read-write

References isReadOnly().

Referenced by close(), copy(), Isis::ProcessByBrick::ProcessCubeInPlace(), Isis::ProcessByBrick::StartProcess(), and Isis::ProcessByBrick::StartProcess().

◆ label()

Pvl * Isis::Cube::label ( ) const

Returns a pointer to the IsisLabel object associated with the cube.

Modifications made to the label will be written when the file is closed if it was opened read-write or created. Take care not to mangle the Core Object as this can produce unexpected results when a new attempt is made to open the file. This pointer is invalid as soon as the cube is closed.

Returns
Pvl Pointer to the Label object associated with the cube.

Referenced by Isis::AlphaCube::AlphaCube(), Isis::ApolloMetricCamera::ApolloMetricCamera(), Isis::ApolloPanoramicCamera::ApolloPanoramicCamera(), attachSpiceFromIsd(), Isis::Camera::Camera(), Isis::CameraFactory::CameraVersion(), Isis::Chandrayaan1M3Camera::Chandrayaan1M3Camera(), Isis::ClipperNacRollingShutterCamera::ClipperNacRollingShutterCamera(), Isis::ClipperPushBroomCamera::ClipperPushBroomCamera(), Isis::ClipperWacFcCamera::ClipperWacFcCamera(), Isis::ObservationNumber::Compose(), Isis::SerialNumber::Compose(), copy(), Isis::CameraFactory::Create(), Isis::ProjectionFactory::CreateFromCube(), Isis::CrismCamera::CrismCamera(), Isis::CTXCamera::CTXCamera(), Isis::DawnFcCamera::DawnFcCamera(), Isis::DawnVirCamera::DawnVirCamera(), deleteGroup(), Isis::DemShape::DemShape(), fromIsd(), fromIsd(), fromLabel(), Isis::CubeViewport::getBandFilterName(), group(), hasBlob(), hasGroup(), Isis::HayabusaAmicaCamera::HayabusaAmicaCamera(), Isis::HayabusaNirsCamera::HayabusaNirsCamera(), Isis::HiresCamera::HiresCamera(), Isis::HiriseCamera::HiriseCamera(), Isis::HrscCamera::HrscCamera(), Isis::Hyb2OncCamera::Hyb2OncCamera(), Isis::IdealCamera::IdealCamera(), Isis::ImageImporter::import(), Isis::Image::isFootprintable(), Isis::Shape::isFootprintable(), isProjected(), Isis::IssNACamera::IssNACamera(), Isis::IssWACamera::IssWACamera(), Isis::JunoCamera::JunoCamera(), Isis::KaguyaMiCamera::KaguyaMiCamera(), Isis::KaguyaTcCamera::KaguyaTcCamera(), Isis::Kernels::Kernels(), Isis::LoHighCamera::LoHighCamera(), Isis::LoMediumCamera::LoMediumCamera(), Isis::LroNarrowAngleCamera::LroNarrowAngleCamera(), Isis::LroWideAngleCamera::LroWideAngleCamera(), Isis::LwirCamera::LwirCamera(), Isis::MarciCamera::MarciCamera(), Isis::Mariner10Camera::Mariner10Camera(), Isis::MdisCamera::MdisCamera(), Isis::MexHrscSrcCamera::MexHrscSrcCamera(), Isis::MiniRF::MiniRF(), Isis::MocNarrowAngleCamera::MocNarrowAngleCamera(), Isis::MocWideAngleCamera::MocWideAngleCamera(), Isis::MsiCamera::MsiCamera(), Isis::NewHorizonsLeisaCamera::NewHorizonsLeisaCamera(), Isis::NewHorizonsLorriCamera::NewHorizonsLorriCamera(), Isis::NewHorizonsMvicFrameCamera::NewHorizonsMvicFrameCamera(), Isis::NewHorizonsMvicTdiCamera::NewHorizonsMvicTdiCamera(), Isis::NirCamera::NirCamera(), Isis::OsirisRexOcamsCamera::OsirisRexOcamsCamera(), projection(), Isis::Process::PropagateTables(), putGroup(), read(), Isis::ProjectionFactory::RingsCreateFromCube(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::RosettaOsirisCamera::RosettaOsirisCamera(), Isis::RosettaVirtisCamera::RosettaVirtisCamera(), Isis::Process::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::Spice::Spice(), Isis::SsiCamera::SsiCamera(), Isis::ProcessMosaic::StartProcess(), Isis::TgoCassisCamera::TgoCassisCamera(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::ThemisVisCamera::ThemisVisCamera(), Isis::UniversalGroundMap::UniversalGroundMap(), Isis::AlphaCube::UpdateGroup(), Isis::UvvisCamera::UvvisCamera(), Isis::VikingCamera::VikingCamera(), Isis::VimsCamera::VimsCamera(), and Isis::VoyagerCamera::VoyagerCamera().

◆ labelsAttached()

bool Isis::Cube::labelsAttached ( ) const

Test if labels are attached.

If a cube is open, then this indicates whether or not the opened cube's labels are attached. If a cube is not open, then this indicates whether or not a cube will be created with attached labels if create(...) is called.

Returns
True for attached labels, false for detached

◆ labelSize()

int Isis::Cube::labelSize ( bool actual = false) const

Returns the number of bytes used by the label.

Parameters
actualTrue for consumed size, false for allocated size (i.e. the number of bytes in the cube set aside for the label).
Returns
int the number of bytes used by the label.

References labelSize().

Referenced by copy(), labelSize(), open(), and Isis::Process::SetOutputCube().

◆ latLonRange()

void Isis::Cube::latLonRange ( double & minLatitude,
double & maxLatitude,
double & minLongitude,
double & maxLongitude )

Returns the latitude and longitude range for the Cube.

More accurate than the minimum and maximum latitude and longitude from the mapping group.

Parameters
[out]minLatitudeminimum latitude present in the cube
[out]maxLatitudemaximum latitude present in the cube
[out]minLongitudeminimum longitude present in the cube
[out]maxLongitudemaximum longitude present in the cube

References _FILEINFO_, camera(), hasGroup(), lineCount(), projection(), sampleCount(), Isis::IException::Unknown, and Isis::IException::User.

◆ lineCount()

◆ multiplier()

double Isis::Cube::multiplier ( ) const

Returns the multiplier value for converting 8-bit/16-bit pixels to 32-bit.

\[ out = in * multiplier + base \]

Returns
double The multiplier value for converting 8-bit/16-bit pixels to 32-bit.

Referenced by copy().

◆ open()

void Isis::Cube::open ( const QString & cubeFileName,
QString access = "r" )

◆ physicalBand()

int Isis::Cube::physicalBand ( const int & virtualBand) const
virtual

This method will return the physical band number given a virtual band number.

Physical and virtual bands always match unless the programmer made a call to SetVirtualBand prior to opening the cube.

Parameters
virtualBandVirtual band to translate to physical band.
Returns
int The physical band number.

References _FILEINFO_, physicalBand(), Isis::IException::Programmer, and Isis::toString().

Referenced by Isis::CubeViewport::getAllWhatsThisInfo(), and physicalBand().

◆ pixelType()

◆ projection()

Projection * Isis::Cube::projection ( )
Returns
a projection associated with the cube. The generation of the projection can throw an exception, so you might want to catch errors if that interests you.

References Isis::ProjectionFactory::CreateFromCube(), isOpen(), and label().

Referenced by Isis::CubeViewport::CubeViewport(), Isis::DemShape::DemShape(), Isis::ImagePolygon::initCube(), latLonRange(), Isis::Chip::Load(), Isis::OverlapStatistics::OverlapStatistics(), and Isis::ProcessMapMosaic::StartProcess().

◆ putGroup()

void Isis::Cube::putGroup ( const PvlGroup & group)

Adds a group in a Label to the cube.

If the group already exists in the cube it will be completely overwritten. This will only work on output cubes, therefore, input cubes will not be updated.

Parameters
[in]groupLabel containing the group to put.

References _FILEINFO_, fileName(), Isis::PvlObject::findObject(), group(), isReadOnly(), label(), Isis::PvlContainer::name(), and Isis::IException::Programmer.

Referenced by fromLabel(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::ProcessMapMosaic::SetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

◆ read() [1/2]

◆ read() [2/2]

void Isis::Cube::read ( Buffer & bufferToFill) const

This method will read a buffer of data from the cube as specified by the contents of the Buffer object.

Parameters
bufferToFillBuffer to be loaded

References _FILEINFO_, isOpen(), Isis::IException::Programmer, and Isis::CubeIoHandler::read().

◆ readCubeStretch()

CubeStretch Isis::Cube::readCubeStretch ( QString name = "CubeStretch",
const std::vector< PvlKeyword > keywords = std::vector<PvlKeyword>() ) const

Read a Stretch from a cube.

Parameters
nameThe name of the Stretch Blob
keywordsA set of keywords and values to match in the Stretch Blob label. This can be used to read the stretch for a specific band.
Returns
CubeStretch

References _FILEINFO_, fileName(), read(), and Isis::IException::User.

◆ readFootprint()

ImagePolygon Isis::Cube::readFootprint ( ) const

◆ readHistory()

History Isis::Cube::readHistory ( const QString & name = "IsisCube") const

Read the History from the Cube.

Parameters
nameThe name of the History Blob to read. This is used for reading History from Cubes made prior to the History Blob name being standardized.

References read().

Referenced by Isis::Process::WriteHistory().

◆ readOriginalLabel()

OriginalLabel Isis::Cube::readOriginalLabel ( const QString & name = "IsisCube") const

Read the original PDS3 label from a cube.

Parameters
nameThe name of the OriginalLabel Blob
Returns
OriginalLabel The original PDS3 label as a PVL document

References _FILEINFO_, fileName(), read(), and Isis::IException::User.

◆ readOriginalXmlLabel()

OriginalXmlLabel Isis::Cube::readOriginalXmlLabel ( ) const

Read the original PDS4 label from a cube.

Returns
OriginalXmlLabel The original PDS4 label as an XML document

References _FILEINFO_, fileName(), read(), and Isis::IException::User.

◆ readTable()

Table Isis::Cube::readTable ( const QString & name)

Read a Table from the cube.

Parameters
nameThe name of the Table to read
Returns
Table

References _FILEINFO_, fileName(), Isis::IException::Programmer, and read().

Referenced by Isis::Blobber::load().

◆ relocateDnData()

void Isis::Cube::relocateDnData ( FileName dnDataFile)

Relocates the DN data for a cube to an external cube label file.

Parameters
dnDataFileFileName to relocate the dn data to

References _FILEINFO_, Isis::PvlObject::findObject(), isOpen(), Isis::FileName::original(), reopen(), and Isis::IException::Unknown.

◆ reopen()

void Isis::Cube::reopen ( QString access = "r")

This method will reopen an isis sube for reading or reading/writing.

If access requested is read/write and the open fails, open as read only and throw error.

Parameters
[in]access(QString) Type of access needed (read or read/write

References _FILEINFO_, close(), Isis::FileName::expanded(), open(), and Isis::IException::Programmer.

Referenced by fromIsd(), relocateDnData(), and Isis::FileTool::save().

◆ sampleCount()

◆ setBaseMultiplier()

void Isis::Cube::setBaseMultiplier ( double base,
double mult )

Used prior to the Create method, this will specify the base and multiplier for converting 8-bit/16-bit back and forth between 32-bit:

\[ 32-bit pixel = 8-bit/16-bit pixel * multiplier + base \]

Parameters
baseAdditive constant.
multMultiplicative constant.

References base().

Referenced by copy(), and Isis::Process::SetOutputCube().

◆ setByteOrder()

void Isis::Cube::setByteOrder ( ByteOrder byteOrder)

Used prior to the Create method, this will specify the byte order of pixels, either least or most significant byte.

Parameters
byteOrderAn enumeration of either Msb or Lsb.

References byteOrder().

Referenced by copy(), create(), and Isis::Process::SetOutputCube().

◆ setDimensions()

void Isis::Cube::setDimensions ( int ns,
int nl,
int nb )

Used prior to the Create method to specify the size of the cube.

If not invoked, a 512 x 512 x 1 cube will be created.

Parameters
nsNumber of samples
nlNumber of lines
nbNumber of bands

References _FILEINFO_, and Isis::IException::Programmer.

Referenced by copy(), Isis::ImageImporter::createOutput(), Isis::Process::SetOutputCube(), Isis::ProcessMosaic::StartProcess(), and Isis::Chip::Write().

◆ setExternalDnData()

void Isis::Cube::setExternalDnData ( FileName cubeFileWithDnData)

Used to set external dn data to cube.

Parameters
cubeFileWithDnDataFileName of the cube with DN Data

Referenced by copy().

◆ setFormat()

void Isis::Cube::setFormat ( Format format)

Used prior to the Create method, this will specify the format of the cube, either band, sequential or tiled.

If not invoked, a tiled file will be created.

Parameters
formatAn enumeration of either Bsq or Tile.

References format().

Referenced by copy(), create(), Isis::ImageExporter::initializeProcess(), and Isis::Process::SetOutputCube().

◆ setLabelsAttached()

void Isis::Cube::setLabelsAttached ( bool attach)

Use prior to calling create, this sets whether or not to use separate label and data files.

Parameters
attachIf false, the labels and data will be in separate files.

Referenced by copy(), create(), and Isis::Process::SetOutputCube().

◆ setLabelSize()

void Isis::Cube::setLabelSize ( int labelBytes)

Used prior to the Create method, this will allocate a specific number of bytes in the label area for attached files.

If not invoked, 65536 bytes will be reserved by default.

Parameters
[in]labelBytesNumber of bytes to reserve for label space.

Referenced by copy(), and Isis::Process::SetOutputCube().

◆ setMinMax()

void Isis::Cube::setMinMax ( double min,
double max )

Used prior to the Create method, this will compute a good base and multiplier value given the minimum/maximum range of the 32bit data.

For example, min=0.0 and max=1.0 of 32-bit pixels will ensure the base and multiplier will cause the data to be spread out fully in the 8=bit or 16-bit range.

Parameters
minMinimum 32-bit pixel.
maxMaximum 32-bit pixel.

References Isis::SignedWord, Isis::UnsignedByte, Isis::UnsignedWord, Isis::VALID_MAX1, Isis::VALID_MAX2, Isis::VALID_MAXU2, Isis::VALID_MIN1, Isis::VALID_MIN2, and Isis::VALID_MINU2.

Referenced by copy(), create(), and Isis::Process::SetOutputCube().

◆ setPixelType()

void Isis::Cube::setPixelType ( PixelType pixelType)

Used prior to the Create method, this will specify the output pixel type.

If not invoked, the pixel type will be Real.

Parameters
pixelTypeAn enumeration of the pixelType desired in the output cube. See PixelType documentation for more information.

References pixelType().

Referenced by copy(), create(), Isis::Process::SetOutputCube(), and Isis::ProcessMosaic::StartProcess().

◆ setVirtualBands() [1/2]

void Isis::Cube::setVirtualBands ( const QList< QString > & vbands)

This allows the programmer to specify a subset of bands to work with.

This works with both read and write operations, but is typically only used for reading. This is helpful because users can specify which bands from an input cube they want to work with. For example, if the user only wants to work with band 5 out of a 10 band cube, this can be accommodated.

Parameters
[in]vbandsA vector of strings containing the virtual bands. The vector must contain integers in string form (e.g., "5", "10", "1").

References Isis::CubeIoHandler::setVirtualBands(), and Isis::toInt().

Referenced by Isis::Workspace::addCubeViewport(), Isis::Workspace::addCubeViewportFromList(), open(), Isis::Process::SetInputCube(), and setVirtualBands().

◆ setVirtualBands() [2/2]

void Isis::Cube::setVirtualBands ( const std::vector< QString > & vbands)

This is a deprecated version of setVirtualBands(const QList<QString> &).

Parameters
[in]vbandsA vector of strings containing the virtual bands. The vector must contain integers in string form (e.g., "5", "10", "1").

References setVirtualBands().

◆ statistics() [1/2]

Statistics * Isis::Cube::statistics ( const int & band,
const double & validMin,
const double & validMax,
QString msg = "Gathering statistics" )

This method returns a pointer to a Statistics object which allows the program to obtain and use various statistics from the cube.

Cube does not retain ownership of the returned pointer - please delete it when you are done with it.

Parameters
bandReturns the statistics for the specified band. If the user specifies 0 for this parameter, the method will loop through every band in the cube and accumulate statistics from each band seperately
validMin
validMax
msg
Returns
Statistics*

References _FILEINFO_, bandCount(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), isOpen(), lineCount(), Isis::IException::Programmer, read(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::Buffer::size().

◆ statistics() [2/2]

Statistics * Isis::Cube::statistics ( const int & band = 1,
QString msg = "Gathering statistics" )

This method returns a pointer to a Statistics object which allows the program to obtain and use various statistics from the cube.

Cube does not retain ownership of the returned pointer - please delete it when you are done with it.

Parameters
[in]band(Default value is 1) Returns the statistics for the specified band.If the user specifies 0 for this parameter, the method will loop through every band in the cube and accumulate statistics from each band seperately
msgThe message to display with the percent process while gathering statistics
Returns
(Histogram) A pointer to a Statistics object containing details such as the minimum and maximum pixel values for the input cube on the band specified, or all bands as the case may be.

References statistics(), Isis::ValidMaximum, and Isis::ValidMinimum.

Referenced by statistics().

◆ storesDnData()

bool Isis::Cube::storesDnData ( ) const

This method returns a boolean value.

Returns
bool

Referenced by externalCubeFileName().

◆ write() [1/8]

◆ write() [2/8]

void Isis::Cube::write ( Buffer & bufferToWrite)

This method will write a buffer of data from the cube as specified by the contents of the Buffer object.

Parameters
bufferToWriteBuffer to be written.

References _FILEINFO_, fileName(), isOpen(), isReadOnly(), Isis::IException::Programmer, Isis::IException::Unknown, and Isis::CubeIoHandler::write().

◆ write() [3/8]

void Isis::Cube::write ( const CubeStretch & cubeStretch)

Write a Stretch to the Cube.

The stretch will be written to the Cube as a BLOB and can be accessed using Cube::readCubeStretch.

Parameters
cubeStretchThe stretch to write to the Cube.

References write().

◆ write() [4/8]

void Isis::Cube::write ( const ImagePolygon & polygon)

Write a polygon to the Cube.

The polygon will be written to the Cube as a BLOB and can be accessed using Cube::readFootprint.

References write().

◆ write() [5/8]

void Isis::Cube::write ( const OriginalXmlLabel & lab)

This method will write an OriginalXmlLabel object.

to the cube as specified by the contents of the Blob object.

Parameters
Originalxml label data to be written

References write().

◆ write() [6/8]

void Isis::Cube::write ( const Table & table)

Write a Table to the Cube.

The Table will be written to the Cube as a BLOB and can be accessed using Cube::readTable.

Parameters
tableThe table to write to the Cube

References Isis::Table::toBlob(), and write().

◆ write() [7/8]

void Isis::Cube::write ( History & history,
const QString & name = "IsisCube" )

Write an updated History to the Cube.

The History will be written to the Cube as a BLOB and can be accessed using Cube::readHistory.

Parameters
historyThe history to write to the Cube.
nameThe name for the history BLOB. This is used for backwards compatibility with cubes from before the History BLOB name was standardized.

References Isis::History::toBlob(), and write().

◆ write() [8/8]

void Isis::Cube::write ( OriginalLabel & lab)

This method will write an OriginalLabel object.

to the cube as specified by the contents of the Blob object.

Parameters
Originallabel data to be written

References write().


The documentation for this class was generated from the following files: