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

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.

◆ 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 Isis::FileName::toString().

◆ ~Cube()

Isis::Cube::~Cube ( )
virtual

Destroys the Cube object.

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_.

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

◆ 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.

◆ 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

◆ camera()

◆ 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.

◆ 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.

Referenced by Isis::ImageOverlapSet::FindImageOverlaps(), Isis::Process::PropagateTables(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::FileTool::saveAsCubeByOption(), Isis::ProcessMapMosaic::SetOutputCube(), and Isis::Chip::Write().

◆ 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
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::FileName::addExtension(), Isis::PvlObject::addGroup(), Isis::PvlObject::addObject(), ASSERT, Isis::ByteOrderName(), Isis::FileName::expanded(), Isis::FileName::name(), Isis::None, Isis::PixelTypeName(), Isis::ReadWrite, Isis::FileName::setExtension(), Isis::SizeOf(), and Isis::toString().

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

◆ 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, Isis::CubeAttributeOutput::byteOrder(), Isis::CubeAttributeOutput::fileFormat(), Isis::CubeAttributeOutput::labelAttachment(), Isis::CubeAttributeOutput::maximum(), Isis::CubeAttributeOutput::minimum(), Isis::CubeAttributeOutput::pixelType(), and Isis::CubeAttributeOutput::propagatePixelType().

◆ 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::findKeyword(), Isis::PvlContainer::name(), and Isis::PvlObject::object().

Referenced by Isis::StretchTool::deleteFromCube().

◆ 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::deleteGroup(), Isis::PvlObject::findObject(), and Isis::PvlObject::hasGroup().

Referenced by Isis::SubArea::UpdateLabel().

◆ 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_, and Isis::PvlObject::findObject().

Referenced by Isis::Image::copyToNewProjectRoot(), Isis::Shape::copyToNewProjectRoot(), 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.

◆ 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 Isis::FileName::baseName(), and Isis::FileName::expanded().

◆ 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 Isis::FileName::toString().

◆ 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 Isis::PvlObject::beginGroup(), Isis::PvlObject::endGroup(), Isis::FileName::expanded(), Isis::PvlObject::findObject(), and Isis::FileName::toString().

◆ 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::findGroup(), and Isis::PvlObject::findObject().

Referenced by Isis::HiEqualization::errorCheck(), Isis::HiLab::HiLab(), Isis::HiCalData::load(), 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 Isis::PvlObject::hasKeyword(), Isis::PvlContainer::isNamed(), and Isis::PvlObject::object().

Referenced by Isis::CameraFactory::Create(), 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(), and Isis::PvlObject::hasGroup().

Referenced by Isis::CubeViewport::CubeViewport(), and Isis::SubArea::UpdateLabel().

◆ 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

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_, Isis::Histogram::AddData(), Isis::Histogram::BinRangeEnd(), Isis::Histogram::BinRangeStart(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::Histogram::SetValidRange(), 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 Isis::ValidMaximum, and Isis::ValidMinimum.

◆ 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 ASSERT.

Referenced by Isis::CubeViewport::CubeViewport(), and Isis::Process::SetInputCube().

◆ 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

◆ 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_, and Isis::ReadWrite.

Referenced by Isis::StretchTool::deleteFromCube(), Isis::EditTool::mouseButtonRelease(), Isis::EditTool::rubberBandComplete(), and Isis::StretchTool::saveStretchToCube().

◆ 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

Referenced by Isis::ProcessByBrick::ProcessCubeInPlace(), 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(), 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(), Isis::StretchTool::deleteFromCube(), Isis::DemShape::DemShape(), Isis::CubeViewport::getBandFilterName(), 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(), Isis::IssNACamera::IssNACamera(), Isis::IssWACamera::IssWACamera(), Isis::JunoCamera::JunoCamera(), Isis::KaguyaMiCamera::KaguyaMiCamera(), Isis::KaguyaTcCamera::KaguyaTcCamera(), Isis::Kernels::Kernels(), Isis::StretchTool::loadStretchFromCube(), 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(), Isis::Process::PropagateTables(), Isis::ProjectionFactory::RingsCreateFromCube(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::RosettaOsirisCamera::RosettaOsirisCamera(), Isis::RosettaVirtisCamera::RosettaVirtisCamera(), Isis::StretchTool::saveStretchToCube(), Isis::Process::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::Spice::Spice(), Isis::SsiCamera::SsiCamera(), Isis::TgoCassisCamera::TgoCassisCamera(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::ThemisVisCamera::ThemisVisCamera(), Isis::UniversalGroundMap::UniversalGroundMap(), Isis::AlphaCube::UpdateGroup(), Isis::SubArea::UpdateLabel(), Isis::SpectralPlotTool::updateTool(), 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.

Referenced by 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_, Isis::Camera::SetImage(), Isis::Projection::SetWorld(), Isis::TProjection::UniversalLatitude(), Isis::Sensor::UniversalLatitude(), Isis::TProjection::UniversalLongitude(), and Isis::Sensor::UniversalLongitude().

◆ 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.

◆ open()

◆ 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_, and Isis::toString().

Referenced by Isis::CubeViewport::getAllWhatsThisInfo().

◆ 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.

Referenced by Isis::ShapeModelFactory::create(), Isis::CubeViewport::CubeViewport(), Isis::DemShape::DemShape(), Isis::Equalization::errorCheck(), Isis::ImagePolygon::initCube(), Isis::Chip::Load(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessMapMosaic::StartProcess(), and Isis::SubArea::UpdateLabel().

◆ 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_, Isis::PvlObject::addGroup(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::hasGroup(), and Isis::PvlContainer::name().

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

◆ 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_.

◆ 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_.

Referenced by Isis::StretchTool::loadStretchFromCube().

◆ readFootprint()

ImagePolygon Isis::Cube::readFootprint ( ) const

Read the footprint polygon for the Cube.

Returns
ImagePolygon

References _FILEINFO_.

Referenced by Isis::ImageOverlapSet::FindImageOverlaps(), and Isis::UniversalGroundMap::GroundRange().

◆ 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.

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_.

◆ 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_.

◆ 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_.

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_, and Isis::FileName::original().

◆ 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_, and Isis::FileName::expanded().

Referenced by Isis::StretchTool::deleteFromCube(), Isis::EditTool::mouseButtonRelease(), Isis::EditTool::rubberBandComplete(), Isis::FileTool::save(), and Isis::StretchTool::saveStretchToCube().

◆ 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.

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.

Referenced by copy(), 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_.

Referenced by copy(), Isis::ImageImporter::createOutput(), Isis::Process::SetOutputCube(), 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.

Referenced by copy(), 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(), 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(), 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.

Referenced by copy(), 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::toInt().

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

◆ 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").

◆ 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_, Isis::Statistics::AddData(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::Statistics::SetValidRange(), 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 Isis::ValidMaximum, and Isis::ValidMinimum.

◆ storesDnData()

bool Isis::Cube::storesDnData ( ) const

This method returns a boolean value.

Returns
bool

Referenced by Isis::Image::copyToNewProjectRoot(), and Isis::Shape::copyToNewProjectRoot().

◆ write() [1/8]

void Isis::Cube::write ( Blob blob,
bool  overwrite = true 
)

◆ 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_.

◆ 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 Isis::CubeStretch::toBlob().

◆ 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 Isis::ImagePolygon::toBlob().

◆ 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 Isis::OriginalXmlLabel::toBlob().

◆ 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().

◆ 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().

◆ 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 Isis::OriginalLabel::toBlob().


The documentation for this class was generated from the following files:
Isis::Cube::Format
Format
These are the possible storage formats of ISIS cubes.
Definition: Cube.h:178
Isis::ByteOrder
ByteOrder
Tests the current architecture for byte order.
Definition: Endian.h:42
Isis::PixelType
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:27
Isis::Real
@ Real
Definition: PixelType.h:35