Isis 3 Programmer 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 Isis3 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...
 
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 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
 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...
 
void write (Blob &blob)
 This method will write a blob of data (e.g. 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:

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

. 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 BlobType, QString BlobName)
 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...
 
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...
 

Private Member Functions

void applyVirtualBandsToLabel ()
 Applies virtual bands to label. More...
 
void cleanUp (bool remove)
 This clears all of the allocated memory associated with an open cube. More...
 
void construct ()
 Initialize members from their initial undefined states. More...
 
QFile * dataFile () const
 This returns the QFile with cube DN data in it. More...
 
FileName realDataFileName () const
 This gets the file name of the file which actually contains the DN data. More...
 
void initialize ()
 This sets Cube to its default state: Native byte order Format = Tile PixelType = Real (4 bytes per pixel) Attached labels Label size = 65536 bytes

samples, lines, bands unset

Base = 0 Multiplier = 1.0. More...
 
void initCoreFromLabel (const Pvl &label)
 This function initializes the Cube core from a Pvl Label passed as a parameter. More...
 
void initLabelFromFile (FileName labelFileName, bool readWrite)
 This function initializes the Cube label from a file passed as a parameter. More...
 
void openCheck ()
 Throw an exception if the cube is not open. More...
 
Pvl realDataFileLabel () const
 Function to read data from a cube label and return it as a PVL object. More...
 
void reformatOldIsisLabel (const QString &oldCube)
 This is a helper, used by open(...), that handles opening Isis 2 cubes as if they were Isis 3 cubes. More...
 
void writeLabels ()
 Write the Pvl labels to the cube's label file. More...
 

Private Attributes

QFile * m_labelFile
 This is the file that contains the labels always; if labels are attached then this contains the file data also. More...
 
QFile * m_dataFile
 This is only sometimes allocated. More...
 
CubeIoHandlerm_ioHandler
 This does the heavy lifting for cube DN IO and is always allocated when isOpen() is true. More...
 
ByteOrder m_byteOrder
 The byte order of the opened cube; if there is no open cube then this is the byte order that will be used when a new cube is created. More...
 
Format m_format
 If isOpen() then this is the IO format that the cube uses. More...
 
PixelType m_pixelType
 This is the pixel type on disk. More...
 
QMutex * m_mutex
 Basic thread-safety mutex; this class is not optimized for threads. More...
 
Cameram_camera
 Camera allocated from the camera() method. More...
 
Projectionm_projection
 Projection allocated from the projection() method. More...
 
FileNamem_labelFileName
 The full filename of the label file (.lbl or .cub) More...
 
FileNamem_dataFileName
 The full filename of the data file (.cub) More...
 
FileNamem_tempCube
 If open was called with an Isis 2 cube, then this will be the name of the imported Isis3 cube. More...
 
FileNamem_formatTemplateFile
 Label pvl format template file (describes how to format labels) More...
 
bool m_attached
 True if labels are attached. More...
 
bool m_storesDnData
 True (most common case) when the cube DN data is inside the file we're writing to. More...
 
Pvlm_label
 The label if IsOpen(), otherwise NULL. More...
 
int m_labelBytes
 The maximum allowed size of the label; the allocated space. More...
 
int m_samples
 The sample count of the open cube or the cube that will be created. More...
 
int m_lines
 The line count of the open cube or the cube that will be created. More...
 
int m_bands
 The band count of the open cube or the cube that will be created. More...
 
double m_base
 The base of the open cube or the cube that will be created; does not apply if m_pixelType is Real. More...
 
double m_multiplier
 The multiplier of the open cube or the cube that will be created; does not apply if m_pixelType is Real. More...
 
QList< int > * m_virtualBandList
 If allocated, converts from physical on-disk band # to virtual band #. 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
Todo:
There are undocumented methods and private variables in the Cube class. Also, it needs an example.
History:

2003-03-31 Jeff Anderson - updated unitTest truth file.

2003-05-16 Stuart Sides - modified schema from astrogeology...isis.astrogeology

2003-05-21 Jeff Anderson - added read/write methods to improve speed for IsisLine buffer managers. Also added error checks on reads, writes, and seeks.

2003-05-30 Jeff Anderson - added PhysicalBand method and updated unitTest.

2003-10-06 Jeff Anderson - added PVL to create method to allow for propagation of Pixel specifications.

2003-10-15 Jeff Anderson - fixed bad error check in PhysicalBand method.

2004-01-30 Jeff Anderson - added many Set methods. Major refractor of the class.

2004-02-12 Jeff Anderson - added pruning of the band bin group given the virtual band list.

2004-02-17 Jeff Anderson - modified the number of bands in the label if a virtual band list was given.

2004-03-01 Jeff Anderson - added ability to read Isis 2.1 cube format.

2004-04-01 Jeff Anderson - fixed bug swapping NULL cache tile for non-native cubes in move method.

2005-03-24 Jeff Anderson - Added methods to return a camera or projection associated with the cube.

2005-07-18 Elizabeth Ribelin - Fixed bug in method that returns a projection associated with the cube

2005-10-03 Elizabeth Miller - Added error check to Write(blob)

2006-02-24 Kris Becker - Made the destructor virtual to properly allow the class to be inherited.

2006-04-21 Jacob Danton - Modified the WriteLabel method to use the Pvl's format template abilities.

2006-05-17 Elizabeth Miller - Depricated CameraManger to CameraFactory

2006-07-10 Elizabeth Miller - Added max size preference

2006-11-28 Jeff Anderson - Fixed detached blob bug

2007-01-05 Jeff Anderson - Fixed bug when reading/writing outside cube

2007-02-07 Tracie Sucharski - Added ReOpen method

2008-05-09 Steven Lambright - Added Statistics, Histogram, PutGroup, GetGroup, DeleteGroup, HasGroup conveinience methods. Removed excess references to CubeInfo.

2008-05-27 Jeff Anderson - Fixed bug in open method where virtual bands were not handled correctly if a BandBin group did not exist

2008-06-09 Christopher Austin - Improved maximum cube size error message.

2008-06-11 Steven Lambright - Changed prototype for SetVirtualBands

2008-06-18 Christopher Austin - Fixed documentation errors

2008-08-11 Steven Lambright - Added another Statistics method which accepts a valid range – also added another Histogram method which accepts a bin/valid range (applies both).

2008-08-11 Steven Lambright - Fixed definition of IsisCubeDef, problem pointed out by "novas0x2a" (Support Board Member)

2008-12-15 Steven Koechle - Added a method to delete blobs from a cube

2008-12-17 Steven Koechle - BlobDelete method was broken, fixed

2009-06-30 Steven Lambright - Added "HasProjection" for uniform projection existance test

2010-03-22 Steven Lambright - Added a mutex for reading and writing, which makes these methods thread safe.

2011-03-23 Steven Lambright - Added ClearCache method.

2011-06-01 Jai Rideout and Steven Lambright - Updated API to conform to new Isis standards, re-implemented IO handler and implemented new caching algorithms that can automatically apply themselves when the behavior of the caller changes.

2011-06-27 Steven Lambright - Added addCachingAlgorithm

2011-07-08 Steven Lambright - projection() and camera() will now return NULL if the cube is not open, instead of crashing, references #161

2012-02-17 Steven Lambright - Made the read() method const. Added mutex lock calls around data file accesses.

2012-04-05 Stuart Sides and Steven Lambright - Added new constructor which immediately open the cube.

2012-07-02 Steven Lambright and Stuart Sides - Added copy() and added support for external cube label files (.ecub). This was done so that cubes can be imported into projects without copying the DN data. Also, multiple versions of SPICE will be save-able for one cube (multiple ecubs... again, not copying DN data). Fixes #961.

2012-09-06 Steven Lambright - Improved parsing of ^DnFile in the ecub format and simplified/optimized writeLabels().

2012-09-17 Steven Lambright - Fixed ASSERT in getRealDataFileName() to be in the correct place.

2012-10-26 Steven Lambright and Stuard Sides - Externel cube label files no longer allocate disk space for DN data when writing out blobs.

2012-11-06 Steven Lambright and Mathew Eis - Fixed (the lack of) deletion of temporary files in the unit test. Fixes #1009.

2012-12-31 Steven Lambright - Removed 'get' prefix from accessors. Fixes #1356.

2014-06-20 Ian Humphrey - Added checks to statistics() and histogram() to throw an error if the cube is unopened. Fixes #2085.

2014-10-06 Ian Humphrey - Added case to unittest when chunk dimensions are the same as the buffer shape to ensure virtual bands accessed correctly. Added cases to test creating bsq and large bsq cubes. References #1689.

2015-01-30 Ian Humphrey - Deallocated copied cubes in unittest. References #2082.

2015-06-22 Makayla Shepherd - Using putGroup() a group on the label of a read-only cube now throws an error.

2015-09-02 Tyler Wilson - Commented out first call to SetValidRange in the call to the historgram function. Also commented out a call to Histogram::SetBinRange() because this function no longer exists in Histogram. See Ref. #2188.

2017-06-08 Chris Combs - Made "Failed to create" error messages more descriptive. Fixes #833.

2017-09-22 Cole Neubauer - Fixed documentation. References #4807

2018-01-04 Tracie Sucharski - Allow relative paths that are not "." in the DnFile keyword for ecubs. Changes to ::open to set m_dataFileName for ecubs, and changed ::realDataFileName() to return the absolute path if it is relative. Changed ::realDataFileLabel to call realDataFileName to make sure we get absolute path. Fixes #5276.

2018-01-18 Summer Stapleton - Updated error message in ::create() to address when an IsisPreference file cannot be found. Fixes #5145.

2018-11-16 Jesse Mapel - Made several methods virtual for mocking.

2019-06-15 Kristin Berry - Added latLonRange method to return the valid lat/lon rage of the cube. The values in the mapping group are not sufficiently accurate for some purposes.

Definition at line 170 of file Cube.h.

Member Enumeration Documentation

◆ Format

These are the possible storage formats of Isis3 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.

Definition at line 180 of file Cube.h.

Constructor & Destructor Documentation

◆ Cube() [1/2]

Isis::Cube::Cube ( )

Constructs a Cube object.

Definition at line 58 of file Cube.cpp.

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

Definition at line 70 of file Cube.cpp.

References Isis::FileName::toString().

◆ ~Cube()

Isis::Cube::~Cube ( )
virtual

Destroys the Cube object.

Definition at line 77 of file Cube.cpp.

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

Definition at line 1567 of file Cube.cpp.

References _FILEINFO_.

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

◆ applyVirtualBandsToLabel()

void Isis::Cube::applyVirtualBandsToLabel ( )
private

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

Definition at line 1142 of file Cube.cpp.

Referenced by Isis::FileTool::copyCubeDetails().

◆ 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

Definition at line 1154 of file Cube.cpp.

◆ camera()

◆ cleanUp()

void Isis::Cube::cleanUp ( bool  removeIt)
private

This clears all of the allocated memory associated with an open cube.

Parameters
removeItIf true, the input cube will be removed from disk

Definition at line 1738 of file Cube.cpp.

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

Definition at line 1583 of file Cube.cpp.

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

Definition at line 177 of file Cube.cpp.

Referenced by Isis::ImageOverlapSet::FindImageOverlaps(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::GuiCubeParameter::ViewCube(), Isis::GuiCubeParameter::ViewLabel(), and Isis::Chip::Write().

◆ construct()

void Isis::Cube::construct ( )
private

Initialize members from their initial undefined states.

Definition at line 1786 of file Cube.cpp.

◆ copy()

Cube * Isis::Cube::copy ( FileName  newFile,
const CubeAttributeOutput newFileAttributes 
)

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

Definition at line 331 of file Cube.cpp.

References _FILEINFO_, and Isis::toString().

Referenced by copy(), Isis::FileTool::copyCubeDetails(), 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

Definition at line 521 of file Cube.cpp.

References Isis::AttachedLabel, Isis::CubeAttributeOutput::byteOrder(), Isis::CubeAttributeOutput::fileFormat(), Isis::CubeAttributeOutput::maximum(), Isis::CubeAttributeOutput::minimum(), Isis::CubeAttributeOutput::pixelType(), and Isis::CubeAttributeOutput::propagatePixelType().

◆ dataFile()

QFile * Isis::Cube::dataFile ( ) const
private

This returns the QFile with cube DN data in it.

NULL will be returned if no files are opened.

Returns
A file for cube pixel data I/O

Definition at line 1817 of file Cube.cpp.

◆ deleteBlob()

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

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
BlobTypetype of blob to search for (Polygon, Table, etc)
BlobNameblob to be deleted
Returns
boolean if it found the blob and deleted it.

Definition at line 1600 of file Cube.cpp.

References Isis::PvlObject::deleteObject(), Isis::PvlObject::findKeyword(), Isis::PvlContainer::name(), and Isis::PvlObject::object().

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

Definition at line 1622 of file Cube.cpp.

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

Definition at line 1180 of file Cube.cpp.

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

Referenced by Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), Isis::ControlPointEditWidget::createControlPoint(), Isis::Shape::deleteFromDisk(), Isis::Image::deleteFromDisk(), and Isis::JigsawRunWidget::CopyImageToResultsFunctor::operator()().

◆ fileName()

QString Isis::Cube::fileName ( ) const
virtual

Returns the opened cube's filename.

This is the name of the file which contains the labels of the cube and not necessarily the cube data.

Returns
The opened cube's filename

Definition at line 1208 of file Cube.cpp.

Referenced by Isis::Workspace::addCubeViewport(), Isis::ImagePolygon::Create(), Isis::StereoTool::createPoint(), Isis::MatchTool::createPoint(), Isis::CubeViewport::CubeViewport(), Isis::FileTool::exportToList(), Isis::FeatureNomenclatureTool::featuresForViewportFound(), Isis::CubeViewport::getAllWhatsThisInfo(), Isis::Image::Image(), Isis::ImagePolygon::initCube(), Isis::CubeViewport::keyPressEvent(), Isis::Chip::Load(), Isis::ControlNetValidMeasure::MetersFromEdge(), Isis::ControlNetTool::mouseButtonRelease(), Isis::EditTool::mouseButtonRelease(), Isis::MatchTool::mouseButtonRelease(), Isis::QnetTool::mouseButtonRelease(), Isis::QnetTool::openGround(), Isis::InterestOperator::Operate(), Isis::OverlapStatistics::OverlapStatistics(), Isis::CubePlotCurve::paint(), Isis::ScatterPlotConfigDialog::refreshWidgetStates(), Isis::AbstractPlotTool::repaintViewports(), Isis::EditTool::rubberBandComplete(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::ScatterPlotWindow::ScatterPlotWindow(), Isis::MatchTool::serialNumberList(), Isis::CubeViewport::setCaption(), Isis::StereoTool::setFiles(), Isis::CubeViewport::setTrackingCube(), Isis::Shape::Shape(), Isis::ChipViewport::stretchFromCubeViewport(), Isis::UniversalGroundMap::UniversalGroundMap(), Isis::MeasureTool::updateDist(), Isis::AdvancedTrackTool::updateRow(), and Isis::ControlNetValidMeasure::ValidStandardOptions().

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

Definition at line 1220 of file Cube.cpp.

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

Definition at line 1636 of file Cube.cpp.

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

Referenced by Isis::HiEqualization::errorCheck(), Isis::HiLab::HiLab(), and Isis::CubeViewport::setTrackingCube().

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

Definition at line 1649 of file Cube.cpp.

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

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

◆ 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

Definition at line 1663 of file Cube.cpp.

References Isis::PvlObject::hasKeyword(), Isis::PvlContainer::isNamed(), and Isis::PvlObject::object().

Referenced by Isis::AdvancedTrackTool::TrackMosaicOrigin(), and Isis::AdvancedTrackTool::updateRow().

◆ histogram() [1/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.

Definition at line 1244 of file Cube.cpp.

References Isis::ValidMaximum, and Isis::ValidMinimum.

◆ histogram() [2/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.

Definition at line 1274 of file Cube.cpp.

References _FILEINFO_, Isis::Histogram::AddData(), 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.

◆ initCoreFromLabel()

void Isis::Cube::initCoreFromLabel ( const Pvl label)
private

This function initializes the Cube core from a Pvl Label passed as a parameter.

Parameters
labelPvl label to initialize from

Definition at line 1922 of file Cube.cpp.

References Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), and Isis::PvlObject::hasKeyword().

◆ initialize()

void Isis::Cube::initialize ( )
private

This sets Cube to its default state: Native byte order Format = Tile PixelType = Real (4 bytes per pixel) Attached labels Label size = 65536 bytes

samples, lines, bands unset

Base = 0 Multiplier = 1.0.

Definition at line 1897 of file Cube.cpp.

◆ initLabelFromFile()

void Isis::Cube::initLabelFromFile ( FileName  labelFileName,
bool  readWrite 
)
private

This function initializes the Cube label from a file passed as a parameter.

Parameters
labelFileNameFileName to initialize from
readWritebool that determines whether the label is an old isis label and needs to be reformatted

Definition at line 1966 of file Cube.cpp.

References _FILEINFO_, Isis::FileName::addExtension(), Isis::FileName::expanded(), Isis::FileName::fileExists(), Isis::Message::FileOpen(), Isis::FileName::original(), and Isis::FileName::setExtension().

◆ 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

Definition at line 100 of file Cube.cpp.

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

Definition at line 119 of file Cube.cpp.

◆ 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

Definition at line 130 of file Cube.cpp.

References _FILEINFO_.

Referenced by Isis::EditTool::mouseButtonRelease(), Isis::EditTool::redoEdit(), Isis::EditTool::rubberBandComplete(), Isis::EditTool::undoAll(), and Isis::EditTool::undoEdit().

◆ 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

Definition at line 152 of file Cube.cpp.

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.

Definition at line 1346 of file Cube.cpp.

Referenced by Isis::AlphaCube::AlphaCube(), Isis::ApolloMetricCamera::ApolloMetricCamera(), Isis::ApolloPanoramicCamera::ApolloPanoramicCamera(), Isis::Camera::Camera(), Isis::CameraFactory::CameraVersion(), Isis::Chandrayaan1M3Camera::Chandrayaan1M3Camera(), Isis::ObservationNumber::Compose(), Isis::SerialNumber::Compose(), copy(), Isis::FileTool::copyCubeDetails(), Isis::CameraFactory::Create(), Isis::ProjectionFactory::CreateFromCube(), Isis::CrismCamera::CrismCamera(), Isis::CTXCamera::CTXCamera(), Isis::DawnFcCamera::DawnFcCamera(), Isis::DawnVirCamera::DawnVirCamera(), Isis::DemShape::DemShape(), Isis::SpectralPlotWindow::drawBandMarkers(), Isis::CubeViewport::getBandFilterName(), Isis::SpectralPlotTool::getSpectralStatistics(), 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::ImportImagesWorkOrder::importConfirmedImages(), Isis::Shape::initCamStats(), Isis::Image::initCamStats(), Isis::Shape::isFootprintable(), Isis::Image::isFootprintable(), 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::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::JigsawRunWidget::on_JigsawAcceptButton_clicked(), Isis::OsirisRexOcamsCamera::OsirisRexOcamsCamera(), Isis::Process::PropagateTables(), Isis::MocLabels::ReadLabels(), Isis::ProjectionFactory::RingsCreateFromCube(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::RosettaOsirisCamera::RosettaOsirisCamera(), Isis::RosettaVirtisCamera::RosettaVirtisCamera(), Isis::BandTool::setBandBin(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::Process::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::Spice::Spice(), Isis::SsiCamera::SsiCamera(), Isis::TgoCassisCamera::TgoCassisCamera(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::ThemisVisCamera::ThemisVisCamera(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), Isis::UniversalGroundMap::UniversalGroundMap(), Isis::AlphaCube::UpdateGroup(), Isis::SubArea::UpdateLabel(), Isis::SpectralPlotTool::updateTool(), Isis::UvvisCamera::UvvisCamera(), Isis::GuiCubeParameter::ViewLabel(), 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

Definition at line 165 of file Cube.cpp.

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

Definition at line 1358 of file Cube.cpp.

Referenced by Isis::FileTool::copyCubeDetails(), 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

Definition at line 2146 of file Cube.cpp.

References _FILEINFO_, Isis::Camera::SetImage(), Isis::Projection::SetWorld(), Isis::Sensor::UniversalLatitude(), Isis::TProjection::UniversalLatitude(), Isis::Sensor::UniversalLongitude(), and Isis::TProjection::UniversalLongitude().

◆ lineCount()

int Isis::Cube::lineCount ( ) const
Returns
the number of lines (y axis/height) in the cube. If no cube is open yet, this is the number of lines that will be written if create(...) is called.

Definition at line 1379 of file Cube.cpp.

Referenced by Isis::AlphaCube::AlphaCube(), Isis::Equalization::applyCorrection(), Isis::ImagePolygon::calcImageBorderCoordinates(), Isis::Process::CalculateStatistics(), Isis::Camera::Camera(), Isis::Shape::createFootprint(), Isis::Image::createFootprint(), Isis::StereoTool::createPoint(), Isis::CubeViewport::cubeContentsChanged(), Isis::CubeViewport::cubeDataChanged(), Isis::CubeViewport::cubeLines(), Isis::CubeViewport::CubeViewport(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::CubeViewport::getAllWhatsThisInfo(), Isis::UniversalGroundMap::GroundRange(), Isis::StretchTool::histFromCube(), Isis::ImagePolygon::initCube(), Isis::ImageExporter::initializeProcess(), Isis::ControlNetValidMeasure::MetersFromEdge(), Isis::EditTool::mouseButtonRelease(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ControlNetValidMeasure::PixelsFromEdge(), Isis::Chip::Read(), Isis::ScatterPlotConfigDialog::refreshWidgetStates(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::RosettaOsirisCamera::RosettaOsirisCamera(), Isis::FileTool::saveAs_FullResolution(), Isis::FileTool::saveAsCubeByOption(), Isis::ScatterPlotData::ScatterPlotData(), Isis::Process::SetInputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessByBrick::SetOutputCube(), Isis::SpectralDefinition2D::SpectralDefinition2D(), Isis::ProcessMapMosaic::StartProcess(), Isis::StretchTool::statsFromCube(), Isis::TileManager::TileManager(), and Isis::SubArea::UpdateLabel().

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

Definition at line 1393 of file Cube.cpp.

Referenced by Isis::FileTool::copyCubeDetails().

◆ open()

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

This method will open an isis cube for reading or reading/writing.

Parameters
[in]cubeFileNameName of the cube file to open. Environment variables in the filename will be automatically expanded.
[in]access(Default value of "r") Defines how the cube will be accessed. Either read-only "r" or read-write "rw".

Definition at line 544 of file Cube.cpp.

References _FILEINFO_, Isis::PvlObject::findObject(), Isis::PvlObject::hasKeyword(), Isis::FileName::name(), Isis::FileName::original(), and Isis::FileName::originalPath().

Referenced by Isis::CubeDataThread::AddCube(), Isis::Workspace::addCubeViewport(), Isis::Workspace::addCubeViewportFromList(), Isis::ProcessPolygons::AppendOutputCube(), Isis::Equalization::calculateOverlapStatistics(), Isis::CameraStatistics::CameraStatistics(), Isis::ShapeModelFactory::create(), Isis::HiEqualization::errorCheck(), Isis::Equalization::errorCheck(), Isis::ImageOverlapSet::FindImageOverlaps(), Isis::GisGeometry::GisGeometry(), Isis::Blobber::load(), Isis::Equalization::loadInputs(), Isis::EditTool::mouseButtonRelease(), Isis::Process::PropagateTables(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::EditTool::rubberBandComplete(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::MatchTool::selectLeftMeasure(), Isis::MatchTool::selectRightMeasure(), Isis::Process::SetInputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessMosaic::SetOutputCube(), Isis::GuiCubeParameter::ViewCube(), and Isis::GuiCubeParameter::ViewLabel().

◆ openCheck()

void Isis::Cube::openCheck ( )
private

Throw an exception if the cube is not open.

Definition at line 2073 of file Cube.cpp.

References _FILEINFO_.

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

Definition at line 1418 of file Cube.cpp.

References _FILEINFO_, and Isis::toString().

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

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

Definition at line 1439 of file Cube.cpp.

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.

Definition at line 1688 of file Cube.cpp.

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]

void Isis::Cube::read ( Blob blob) const

This method will read data from the specified Blob object.

Parameters
[in]blobThe Blob data to be loaded
Returns
(type)return description

Definition at line 724 of file Cube.cpp.

References _FILEINFO_, Isis::Blob::Read(), and Isis::FileName::toString().

Referenced by Isis::CubeViewport::bluePixel(), Isis::Process::CalculateStatistics(), Isis::FileTool::copyCubeDetails(), Isis::ImageOverlapSet::FindImageOverlaps(), Isis::InterestOperator::FindOverlapByImageFootPrint(), Isis::MosaicSceneItem::getPixelValue(), Isis::SpatialPlotTool::getSpatialStatistics(), Isis::SpectralPlotTool::getSpectralStatistics(), Isis::StatisticsTool::getStatistics(), Isis::MosaicSceneItem::getStretch(), Isis::GisBlob::GisBlob(), Isis::CubeViewport::grayPixel(), Isis::CubeViewport::greenPixel(), Isis::UniversalGroundMap::GroundRange(), Isis::StretchTool::histFromCube(), Isis::Histogram::Histogram(), Isis::Image::initQuickFootprint(), Isis::InterestOperator::InterestByMeasure(), Isis::Blobber::load(), Isis::DemShape::localRadius(), Isis::EditTool::mouseButtonRelease(), Isis::ProcessByBrick::ProcessCubeInPlaceFunctor< T >::operator()(), Isis::ProcessByBrick::ProcessCubeFunctor< T >::operator()(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ScatterPlotWindow::paint(), Isis::Process::PropagateTables(), Isis::Chip::Read(), Isis::EditTool::redoEdit(), Isis::CubeViewport::redPixel(), Isis::HistogramTool::refreshPlot(), Isis::FileTool::saveAs_FullResolution(), Isis::FileTool::saveAsFullImage(), Isis::ScatterPlotData::ScatterPlotData(), Isis::ImagePolygon::SetImage(), Isis::ScatterPlotWindow::setMousePosition(), Isis::ProcessByBrick::StartProcess(), Isis::StretchTool::statsFromCube(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), Isis::EditTool::undoEdit(), and Isis::EditTool::writeToCube().

◆ 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

Definition at line 746 of file Cube.cpp.

References _FILEINFO_.

◆ realDataFileLabel()

Pvl Isis::Cube::realDataFileLabel ( ) const
private

Function to read data from a cube label and return it as a PVL object.

Returns
Pvl object

Definition at line 2086 of file Cube.cpp.

References Isis::FileName::expanded(), Isis::PvlObject::findObject(), Isis::PvlObject::hasKeyword(), and Isis::FileName::toString().

◆ realDataFileName()

FileName Isis::Cube::realDataFileName ( ) const
private

This gets the file name of the file which actually contains the DN data.

With ecub's, our data file name could be another ecub or a detached label, so using m_dataFileName is unreasonable.

Returns
FileName object

Definition at line 1832 of file Cube.cpp.

References Isis::FileName::expanded(), Isis::PvlObject::findObject(), Isis::FileName::name(), Isis::FileName::original(), Isis::FileName::path(), and Isis::FileName::toString().

◆ reformatOldIsisLabel()

void Isis::Cube::reformatOldIsisLabel ( const QString &  oldCube)
private

This is a helper, used by open(...), that handles opening Isis 2 cubes as if they were Isis 3 cubes.

Parameters
oldCubeThe filename of the Isis 2 cube

Definition at line 2116 of file Cube.cpp.

References Isis::FileName::expanded(), and Isis::FileName::name().

◆ 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

Definition at line 1081 of file Cube.cpp.

References _FILEINFO_, and Isis::FileName::original().

Referenced by Isis::ImportShapesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), Isis::ImportImagesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), and Isis::JigsawRunWidget::CopyImageToResultsFunctor::operator()().

◆ 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

Definition at line 691 of file Cube.cpp.

References _FILEINFO_, and Isis::FileName::expanded().

Referenced by Isis::EditTool::mouseButtonRelease(), Isis::ImportShapesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), Isis::ImportImagesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), Isis::EditTool::rubberBandComplete(), and Isis::FileTool::save().

◆ sampleCount()

int Isis::Cube::sampleCount ( ) const
Returns
the number of samples (x axis/width) in the cube. If no cube is open yet, this is the number of samples that will be written if create(...) is called.

Definition at line 1452 of file Cube.cpp.

Referenced by Isis::AlphaCube::AlphaCube(), Isis::Equalization::applyCorrection(), Isis::Camera::Camera(), Isis::Shape::createFootprint(), Isis::Image::createFootprint(), Isis::StereoTool::createPoint(), Isis::CubeViewport::cubeContentsChanged(), Isis::CubeViewport::cubeDataChanged(), Isis::CubeViewport::cubeSamples(), Isis::CubeViewport::CubeViewport(), Isis::Enlarge::Enlarge(), Isis::ControlNetStatistics::GenerateImageStats(), Isis::CubeViewport::getAllWhatsThisInfo(), Isis::UniversalGroundMap::GroundRange(), Isis::StretchTool::histFromCube(), Isis::ImagePolygon::initCube(), Isis::ImageExporter::initializeProcess(), Isis::ProcessExportPds::LineBytes(), Isis::ControlNetValidMeasure::MetersFromEdge(), Isis::EditTool::mouseButtonRelease(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ControlNetValidMeasure::PixelsFromEdge(), Isis::CubeCalculator::prepareCalculations(), Isis::Chip::Read(), Isis::Reduce::Reduce(), Isis::ScatterPlotConfigDialog::refreshWidgetStates(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::FileTool::saveAs_FullResolution(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsFullImage(), Isis::ScatterPlotData::ScatterPlotData(), Isis::Process::SetInputCube(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::SpectralDefinition2D::SpectralDefinition2D(), Isis::ProcessMapMosaic::StartProcess(), Isis::StretchTool::statsFromCube(), Isis::TileManager::TileManager(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), and Isis::SubArea::UpdateLabel().

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

Definition at line 866 of file Cube.cpp.

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

Definition at line 917 of file Cube.cpp.

Referenced by copy(), Isis::FileTool::copyCubeDetails(), 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

Definition at line 932 of file Cube.cpp.

References _FILEINFO_.

Referenced by copy(), Isis::FileTool::copyCubeDetails(), 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

Definition at line 949 of file Cube.cpp.

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.

Definition at line 981 of file Cube.cpp.

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

Definition at line 993 of file Cube.cpp.

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

Definition at line 1006 of file Cube.cpp.

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

Definition at line 883 of file Cube.cpp.

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

Definition at line 1019 of file Cube.cpp.

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

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

Definition at line 1036 of file Cube.cpp.

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

Definition at line 1066 of file Cube.cpp.

◆ statistics() [1/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.

Definition at line 1475 of file Cube.cpp.

References Isis::ValidMaximum, and Isis::ValidMinimum.

◆ statistics() [2/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*

Definition at line 1496 of file Cube.cpp.

References _FILEINFO_, Isis::Statistics::AddData(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::Buffer::size().

◆ storesDnData()

bool Isis::Cube::storesDnData ( ) const

This method returns a boolean value.

Returns
bool

Definition at line 1549 of file Cube.cpp.

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

◆ write() [1/2]

◆ write() [2/2]

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.

Definition at line 833 of file Cube.cpp.

References _FILEINFO_.

◆ writeLabels()

void Isis::Cube::writeLabels ( )
private

Write the Pvl labels to the cube's label file.

Excess data in the attached labels is set to 0.

Definition at line 2233 of file Cube.cpp.

References _FILEINFO_, and Isis::FileName::name().

Member Data Documentation

◆ m_attached

bool Isis::Cube::m_attached
private

True if labels are attached.

Definition at line 394 of file Cube.h.

◆ m_bands

int Isis::Cube::m_bands
private

The band count of the open cube or the cube that will be created.

Definition at line 416 of file Cube.h.

◆ m_base

double Isis::Cube::m_base
private

The base of the open cube or the cube that will be created; does not apply if m_pixelType is Real.

Definition at line 422 of file Cube.h.

◆ m_byteOrder

ByteOrder Isis::Cube::m_byteOrder
private

The byte order of the opened cube; if there is no open cube then this is the byte order that will be used when a new cube is created.

Defaults to the OS's byte order.

Definition at line 352 of file Cube.h.

◆ m_camera

Camera* Isis::Cube::m_camera
private

Camera allocated from the camera() method.

Definition at line 372 of file Cube.h.

◆ m_dataFile

QFile* Isis::Cube::m_dataFile
private

This is only sometimes allocated.

This is used for when IsOpen is true and labels are detached so the QFile for the labels does not give us cube data.

Definition at line 339 of file Cube.h.

◆ m_dataFileName

FileName* Isis::Cube::m_dataFileName
private

The full filename of the data file (.cub)

Definition at line 381 of file Cube.h.

◆ m_format

Format Isis::Cube::m_format
private

If isOpen() then this is the IO format that the cube uses.

If there is no file opened then this is the IO format that will be used if a cube is created (using create(...)). This defaults to Tile.

Definition at line 359 of file Cube.h.

◆ m_formatTemplateFile

FileName* Isis::Cube::m_formatTemplateFile
private

Label pvl format template file (describes how to format labels)

Definition at line 391 of file Cube.h.

◆ m_ioHandler

CubeIoHandler* Isis::Cube::m_ioHandler
private

This does the heavy lifting for cube DN IO and is always allocated when isOpen() is true.

Definition at line 345 of file Cube.h.

◆ m_label

Pvl* Isis::Cube::m_label
private

The label if IsOpen(), otherwise NULL.

Definition at line 404 of file Cube.h.

◆ m_labelBytes

int Isis::Cube::m_labelBytes
private

The maximum allowed size of the label; the allocated space.

Definition at line 407 of file Cube.h.

◆ m_labelFile

QFile* Isis::Cube::m_labelFile
private

This is the file that contains the labels always; if labels are attached then this contains the file data also.

The method dataFile() will always give you the appropriate QFile member for reading cube data; this should always be used for the labels.

If isOpen() is true, then this is allocated.

Definition at line 333 of file Cube.h.

◆ m_labelFileName

FileName* Isis::Cube::m_labelFileName
private

The full filename of the label file (.lbl or .cub)

Definition at line 378 of file Cube.h.

◆ m_lines

int Isis::Cube::m_lines
private

The line count of the open cube or the cube that will be created.

Definition at line 413 of file Cube.h.

◆ m_multiplier

double Isis::Cube::m_multiplier
private

The multiplier of the open cube or the cube that will be created; does not apply if m_pixelType is Real.

Definition at line 428 of file Cube.h.

◆ m_mutex

QMutex* Isis::Cube::m_mutex
private

Basic thread-safety mutex; this class is not optimized for threads.

Definition at line 369 of file Cube.h.

◆ m_pixelType

PixelType Isis::Cube::m_pixelType
private

This is the pixel type on disk.

If a cube is open, then this will be the opened cube's pixel type. Otherwise, if a cube is created with create(...) then this pixel type will be used. The default is Real.

Definition at line 366 of file Cube.h.

◆ m_projection

Projection* Isis::Cube::m_projection
private

Projection allocated from the projection() method.

Definition at line 375 of file Cube.h.

◆ m_samples

int Isis::Cube::m_samples
private

The sample count of the open cube or the cube that will be created.

Definition at line 410 of file Cube.h.

◆ m_storesDnData

bool Isis::Cube::m_storesDnData
private

True (most common case) when the cube DN data is inside the file we're writing to.

False means we're referencing another cube's internal DN data for reading, and writing buffers is disallowed.

Definition at line 401 of file Cube.h.

◆ m_tempCube

FileName* Isis::Cube::m_tempCube
private

If open was called with an Isis 2 cube, then this will be the name of the imported Isis3 cube.

m_labelFileName and m_dataFileName will store the Isis 2 cube's information.

Definition at line 388 of file Cube.h.

◆ m_virtualBandList

QList<int>* Isis::Cube::m_virtualBandList
private

If allocated, converts from physical on-disk band # to virtual band #.

Definition at line 431 of file Cube.h.


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