18#include "Application.h"
21#include "CameraFactory.h"
22#include "CubeAttribute.h"
23#include "CubeBsqHandler.h"
24#include "CubeTileHandler.h"
25#include "CubeStretch.h"
29#include "ImageHistogram.h"
30#include "ImagePolygon.h"
31#include "IException.h"
32#include "LineManager.h"
34#include "OriginalLabel.h"
35#include "OriginalXmlLabel.h"
36#include "Preference.h"
37#include "ProgramLauncher.h"
38#include "Projection.h"
39#include "SpecialPixel.h"
40#include "Statistics.h"
42#include "TProjection.h"
103 if (isd.contains(
"line_scan_rate") && (QString)instGrp[
"InstrumentId"] ==
"HRSC") {
104 attachLineScanTableFromIsd(isd);
107 attachSpiceFromIsd(isd);
124 std::ifstream isdStream(isdFile.
expanded().toStdString());
125 std::ifstream labelStream(labelFile.
expanded().toStdString());
127 if (isdStream.fail()) {
128 QString msg = QString(
"failed to open isd stream: %1").arg(isdFile.
expanded());
130 isdFile.
baseName().toStdString().c_str(), 153);
133 if (labelStream.fail()) {
134 QString msg =
"failed to open file stream";
136 fileName.baseName().toStdString().c_str(), 153);
143 labelStream >>
label;
145 catch (std::exception &ex) {
146 QString msg = QString(
"Failed to open label file, %1, %2").arg(labelFile.
expanded()).arg(ex.what());
148 fileName.baseName().toStdString().c_str(), 153);
155 catch (std::exception &ex) {
156 QString msg = QString(
"Failed to open ISD file, %1, %2").arg(isdFile.
expanded()).arg(ex.what());
158 fileName.baseName().toStdString().c_str(), 145);
216 bool readOnly =
false;
219 QString msg =
"No cube opened";
223 if ((
m_labelFile->openMode() & QIODevice::ReadWrite) != QIODevice::ReadWrite)
281 QObject::tr(
"Cube::copy requires the originating cube to be open"),
313 QObject::tr(
"Cannot reduce the output PixelType for [%1] from [%2] without output "
339 for(
int i = 0; i < isisCube.
groups(); i++) {
343 if (
label()->hasObject(
"NaifKeywords")) {
345 label()->findObject(
"NaifKeywords"));
348 for (
int i = 0; i <
m_label->objects(); i++) {
352 Isis::Blob t((QString)obj[
"Name"], obj.name());
369 while (!input.
end()) {
371 output.
Copy(input,
false);
373 result->
write(output);
419 string msg =
"You already have a cube opened";
426 "] cannot be less than 1";
432 QString(
"Cannot create the cube [%1] with a pixel type set to None")
446 int maxSizePreference = 0;
449 Preference::Preferences().findGroup(
"CubeCustomization")[
"MaximumSize"];
451 if (size > maxSizePreference) {
453 msg +=
"The cube you are attempting to create [" + cubeFileName +
"] is ["
454 +
toString(size) +
"GB]. This is larger than the current allowed "
455 "size of [" +
toString(maxSizePreference) +
"GB]. The cube "
459 "wish to create this cube, the maximum value can be changed in your personal "
460 "preference file located in [~/.Isis/IsisPreferences] within the group "
461 "CubeCustomization, keyword MaximumSize. If you do not have an ISISPreference file, "
462 "please refer to the documentation 'Environment and Preference Setup'. Error ";
534 Preference::Preferences().findGroup(
"CubeCustomization");
535 bool overwrite = pref[
"Overwrite"][0].toUpper() ==
"ALLOW";
537 QString msg =
"Cube file [" +
m_labelFileName->original() +
"] exists, " +
538 "user preference does not allow overwrite";
542 if (!
m_labelFile->open(QIODevice::Truncate | QIODevice::ReadWrite)) {
543 QString msg =
"Failed to create [" +
m_labelFile->fileName() +
"]. ";
544 msg +=
"Verify the output path exists and you have permission to write to the path.";
551 QString msg =
"Failed to create [" +
m_dataFile->fileName() +
"]. ";
552 msg +=
"Verify the output path exists and you have permission to write to the path.";
557 QString msg =
"Failed to open [" +
m_dataFile->fileName() +
"] for reading. ";
558 msg +=
"Verify the output path exists and you have permission to read from the path.";
629 void Cube::open(
const QString &cubeFileName, QString access) {
633 string msg =
"You already have a cube opened";
641 if(att.
bands().size() != 0) {
642 vector<QString> bands = att.
bands();
671 FileName dataFileName(core[
"^DnFile"][0]);
699 QString msg =
"Failed to open [" +
m_labelFile->fileName() +
"] with "
707 QString msg =
"Failed to open [" +
m_dataFile->fileName() +
"] with "
715 else if (access ==
"rw") {
717 QString msg =
"Failed to open [" +
m_labelFile->fileName() +
"] with "
725 QString msg =
"Failed to open [" +
m_dataFile->fileName() +
"] with "
731 QString msg =
"Failed to open [" +
m_dataFile->fileName() +
"] with "
739 QString msg =
"Unknown value for access [" + access +
"]. Expected 'r' "
770 if (dataLabel.first) {
771 delete dataLabel.second;
772 dataLabel.second = NULL;
789 QString msg =
"Cube has not been opened yet. The filename to re-open is "
804 if (virtualBandList.size()) {
822 string msg =
"The cube is not opened so you can't read a blob from it";
831 QMutexLocker locker2(
m_ioHandler->dataFileMutex());
844 string msg =
"Try opening a file before you read it";
861 Blob historyBlob(name,
"History");
880 Blob footprintBlob(
"Footprint",
"Polygon");
886 QString msg =
"Footprintinit must be run prior to reading the footprint";
887 msg +=
" with POLYGON=TRUE for cube [" +
fileName() +
"]";
903 Blob origLabelBlob(name,
"OriginalLabel");
908 QString msg =
"Unable to locate OriginalLabel in " +
fileName();
926 Blob stretchBlob(name,
"Stretch");
928 read(stretchBlob, keywords);
931 QString msg =
"Unable to locate Stretch information in " +
fileName();
945 Blob origXmlLabelBlob(
"IsisCube",
"OriginalXmlLabel");
947 read(origXmlLabelBlob);
950 QString msg =
"Unable to locate OriginalXmlLabel in " +
fileName();
966 Blob tableBlob(name,
"Table");
971 QString msg =
"Failed to read table [" + name +
"] from cube [" +
fileName() +
"].";
974 return Table(tableBlob);
986 string msg =
"The cube is not opened so you can't write a blob to it";
991 string msg =
"The cube must be opened in read/write mode, not readOnly";
998 QMutexLocker locker2(
m_ioHandler->dataFileMutex());
1003 ios::in | ios::out | ios::binary);
1004 stream.seekp(0, ios::end);
1007 streampos endByte = stream.tellp();
1012 maxbyte += (streampos)
m_ioHandler->getDataSize();
1016 if (endByte < maxbyte) {
1017 stream.seekp(maxbyte, ios::beg);
1030 QString blobFile(blobFileName.
expanded());
1031 ios::openmode flags = ios::in | ios::binary | ios::out | ios::trunc;
1032 fstream detachedStream;
1033 detachedStream.open(blobFile.toLatin1().data(), flags);
1034 if (!detachedStream) {
1035 QString message =
"Unable to open data file [" +
1093 write(cubeStretchBlob);
1133 string msg =
"Tried to write to a cube before opening/creating it";
1138 QString msg =
"Cannot write to the cube [" + (QString)QFileInfo(
fileName()).fileName() +
1139 "] because it is opened read-only";
1144 QString msg =
"The cube [" + QFileInfo(
fileName()).fileName() +
1145 "] does not support storing DN data because it is using an external file for DNs";
1232 if ((ns < 1) || (nl < 1) || (nb < 1)) {
1233 string msg =
"SetDimensions: Invalid number of sample, lines or bands";
1341 if (vbands.size() > 0) {
1342 QListIterator<QString> it(vbands);
1343 while (it.hasNext()) {
1367 for(
unsigned int i = 0; i < vbands.size(); i++)
1368 realVBands << vbands[i];
1382 QString(
"Cannot relocate the DN data to [%1] for an external cube label "
1383 "file which is not open.")
1391 QString(
"The cube [%1] stores DN data. It cannot be relocated to [%2] - "
1392 "this is only supported for external cube label files.")
1397 m_label->findObject(
"IsisCube").findObject(
"Core").findKeyword(
"^DnFile")[0] =
1472 void Cube::attachSpiceFromIsd(nlohmann::json isd) {
1474 PvlKeyword pckKeyword(
"TargetAttitudeShape");
1475 PvlKeyword targetSpkKeyword(
"TargetPosition");
1485 Table ckTable = spice.instrumentRotation()->Cache(
"InstrumentPointing");
1488 for (
int i = 0; i < ckKeyword.size(); i++)
1489 ckTable.
Label()[
"Kernels"].addValue(ckKeyword[i]);
1491 this->
write(ckTable);
1493 Table spkTable = spice.instrumentPosition()->Cache(
"InstrumentPosition");
1495 for (
int i = 0; i < spkKeyword.size(); i++)
1496 spkTable.
Label()[
"Kernels"].addValue(spkKeyword[i]);
1498 this->
write(spkTable);
1500 Table bodyTable = spice.bodyRotation()->Cache(
"BodyRotation");
1502 for (
int i = 0; i < targetSpkKeyword.size(); i++)
1503 bodyTable.
Label()[
"Kernels"].addValue(targetSpkKeyword[i]);
1505 for (
int i = 0; i < pckKeyword.size(); i++)
1506 bodyTable.
Label()[
"Kernels"].addValue(pckKeyword[i]);
1509 toString(spice.solarLongitude().degrees()));
1510 this->
write(bodyTable);
1512 Table sunTable = spice.sunPosition()->Cache(
"SunPosition");
1514 for (
int i = 0; i < targetSpkKeyword.size(); i++)
1515 sunTable.
Label()[
"Kernels"].addValue(targetSpkKeyword[i]);
1517 this->
write(sunTable);
1523 while (i < label->objects()) {
1525 if (currObj.
isNamed(
"NaifKeywords")) {
1533 *(this->
label()) += spice.getStoredNaifKeywords();
1541 void Cube::attachLineScanTableFromIsd(nlohmann::json isd) {
1546 TableRecord timesRecord;
1547 timesRecord += ephTimeField;
1548 timesRecord += expTimeField;
1549 timesRecord += lineStartField;
1551 Table timesTable(
"LineScanTimes", timesRecord);
1552 for (
size_t i = 0; i < isd[
"line_scan_rate"].size(); ++i) {
1553 timesRecord[0] = isd[
"line_scan_rate"][i][1].get<
double>() + isd[
"center_ephemeris_time"].get<double>();
1554 timesRecord[1] = isd[
"line_scan_rate"][i][2].get<
double>();
1555 timesRecord[2] = (int)(isd[
"line_scan_rate"][i][0].get<double>() + 0.5);
1556 timesTable += timesRecord;
1558 this->
write(timesTable);
1571 "An external cube label file must be opened in order to use "
1572 "Cube::getExternalCubeFileName",
1578 "Cube::getExternalCubeFileName can only be called on an external cube label "
1586 return core[
"^DnFile"][0];
1663 const double &validMax, QString msg) {
1666 QString msg =
"Cannot create histogram object for an unopened cube";
1671 if ((band < 0) || (band >
bandCount())) {
1672 QString msg =
"Invalid band in [CubeInfo::Histogram]";
1676 int bandStart = band;
1677 int bandStop = band;
1694 double binMin = validMin;
1695 double binMax = validMax;
1697 binMin = hist->BinRangeStart();
1701 binMax = hist->BinRangeEnd();
1712 for(
int useBand = bandStart ; useBand <= bandStop ; useBand++) {
1810 if ((virtualBand < 1) ||
1812 QString msg =
"Out of array bounds [" +
toString(virtualBand) +
"]";
1885 const double &validMax, QString msg) {
1888 QString msg =
"Cannot create statistics object for an unopened cube";
1893 if ((band < 0) || (band >
bandCount())) {
1894 string msg =
"Invalid band in [CubeInfo::Statistics]";
1902 stats->SetValidRange(validMin, validMax);
1904 int bandStart = band;
1905 int bandStop = band;
1919 for(
int useBand = bandStart ; useBand <= bandStop ; useBand++) {
1961 QString msg =
"Cannot add a caching algorithm until the cube is open";
1989 for(
int i = 0; i <
m_label->objects(); i++) {
1991 if (obj.
name().compare(BlobType) == 0) {
2057 QString temp = (QString) obj[
"Name"];
2058 temp = temp.toUpper();
2059 QString temp2 = name;
2060 temp2 = temp2.toUpper();
2061 if (temp == temp2)
return true;
2077 return hasBlob(name,
"Table");
2091 QString msg =
"Cannot add a group to the label of cube [" + (QString)QFileInfo(
fileName()).fileName() +
2092 "] because it is opened read-only";
2115 if (
m_label->findObject(
"IsisCube").hasGroup(
"BandBin")) {
2116 PvlGroup &bandBin =
m_label->findObject(
"IsisCube").findGroup(
"BandBin");
2117 for (
int k = 0;k < bandBin.
keywords();k++) {
2206 new FileName(
"$ISISROOT/appdata/templates/labels/CubeFormatTemplate.pft");
2254 dir2.cd(guess.
path());
2255 guess = dir2.absolutePath() +
"/" + guess.
name();
2264 guess = core[
"^DnFile"][0];
2266 if (!guess.
path().startsWith(
"/")) {
2271 result = core[
"^Core"][0];
2277 while (result.
name() ==
"");
2321 const PvlObject &core =
label.findObject(
"IsisCube").findObject(
"Core");
2332 m_byteOrder = ByteOrderEnumeration(pixelsGroup[
"ByteOrder"]);
2333 m_base = pixelsGroup[
"Base"];
2338 if ((QString) core[
"Format"] ==
"BandSequential") {
2347 if (!temp.
expanded().startsWith(
"/")) {
2390 labelFileName = tmp;
2410 labelFileName = tmp;
2430 labelFileName = tmp;
2450 if (
m_label->hasKeyword(
"CCSD3ZF0000100000001NJPL3IF0PDS200000001")) {
2456 " because it is an ISIS2 cube.";
2472 string msg =
"Sorry you can't do a SetMethod after the cube is opened";
2488 core = &
label.findObject(
"IsisCube").findObject(
"Core");
2492 FileName temp((*core)[
"^DnFile"][0]);
2493 if (!temp.
expanded().startsWith(
"/")) {
2514 QString parameters =
"from=" + oldCube;
2517 parameters +=
" to=" + tempCube.
expanded();
2520 QString command =
"$ISISROOT/bin/pds2isis " + parameters;
2524 QString prog =
"pds2isis";
2548 bool isGood =
false;
2549 bool useProj =
true;
2561 QString msg =
"Cannot calculate lat/lon range without a camera or projection";
2570 QString msg =
"Unable to create camera when calculating a lat/lon range.";
2576 minLatitude = 99999;
2577 minLongitude = 99999;
2578 maxLatitude = -99999;
2579 maxLongitude = -99999;
2581 for (
double sample = 0.5; sample <
sampleCount() + 0.5; sample++) {
2583 for (
double line = 0.5; line <
lineCount() + 0.5; line++) {
2585 isGood = proj->
SetWorld(sample, line);
2588 isGood = cam->
SetImage(sample, line);
2603 if (lat < minLatitude) {
2606 else if (lat > maxLatitude) {
2610 if (lon < minLongitude) {
2613 else if (lon > maxLongitude) {
2619 if ( (minLatitude == 99999) || (minLongitude == 99999) || (maxLatitude == -99999) ||
2620 (maxLongitude == -99999) ) {
2621 QString msg =
"Unable to calculate a minimum or maximum latitutde or longitude.";
2632 string msg =
"Cube must be opened first before writing labels";
2642 QMutexLocker locker2(
m_ioHandler->dataFileMutex());
2646 string tempstr = temp.str();
2649 QByteArray labelUnpaddedContents(tempstr.c_str(), tempstr.length());
2650 labelArea.replace(0, labelUnpaddedContents.size(), labelUnpaddedContents);
2657 QString msg =
"Label space is full in [" +
2659 "] unable to write labels";
void Read(const QString &file, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >())
This method reads Pvl values from a specified file.
void Write(const QString &file)
Write the blob data out to a file.
QString Type() const
Accessor method that returns a string containing the Blob type.
QString Name() const
Accessor method that returns a string containing the Blob name.
Buffer for reading and writing cube data.
int size() const
Returns the total number of pixels in the shape buffer.
double * DoubleBuffer() const
Returns the value of the shape buffer.
void Copy(const Buffer &in, bool includeRawBuf=true)
Allows copying of the buffer contents to another Buffer.
Manages a Buffer over a cube.
bool begin()
Moves the shape buffer to the first position.
bool end() const
Returns true if the shape buffer has accessed the end of the cube.
bool next()
Moves the shape buffer to the next position.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Manipulate and parse attributes of output cube filenames.
double minimum() const
Return the output cube attribute minimum.
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
double maximum() const
Return the output cube attribute maximum.
bool propagateMinimumMaximum() const
Return true if the min/max are to be propagated from an input cube.
bool propagatePixelType() const
Return true if the pixel type is to be propagated from an input cube.
Cube::Format fileFormat() const
Return the file format an Cube::Format.
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.
IO Handler for Isis Cubes using the BSQ format.
This is the parent of the caching algorithms.
void addCachingAlgorithm(CubeCachingAlgorithm *)
This will add the given caching algorithm to the list of attempted caching algorithms.
void clearIoCache()
This will clear excess RAM used for quicker IO in the cube.
bool hasTable(const QString &name)
Check to see if the cube contains a pvl table by the provided name.
QFile * m_dataFile
This is only sometimes allocated.
Pvl realDataFileLabel() const
Function to read data from a cube label and return it as a PVL object.
ImagePolygon readFootprint() const
Read the footprint polygon for the Cube.
Cube()
Constructs a Cube object.
void setPixelType(PixelType pixelType)
Used prior to the Create method, this will specify the output pixel type.
void latLonRange(double &minLatitude, double &maxLatitude, double &minLongitude, double &maxLongitude)
Returns the latitude and longitude range for the Cube.
void deleteGroup(const QString &group)
Deletes a group from the cube labels.
void reformatOldIsisLabel(const QString &oldCube)
This is a helper, used by open(...), that handles opening Isis 2 cubes as if they were Isis cubes.
void setFormat(Format format)
Used prior to the Create method, this will specify the format of the cube, either band,...
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.
int m_bands
The band count of the open cube or the cube that will be created.
void initialize()
This sets Cube to its default state: Native byte order Format = Tile PixelType = Real (4 bytes per pi...
PixelType m_pixelType
This is the pixel type on disk.
void relocateDnData(FileName dnDataFile)
Relocates the DN data for a cube to an external cube label file.
void construct()
Initialize members from their initial undefined states.
int m_labelBytes
The maximum allowed size of the label; the allocated space.
virtual Histogram * histogram(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 variou...
void initLabelFromFile(FileName labelFileName, bool readWrite)
This function initializes the Cube label from a file passed as a parameter.
double multiplier() const
Returns the multiplier value for converting 8-bit/16-bit pixels to 32-bit.
CubeIoHandler * m_ioHandler
This does the heavy lifting for cube DN IO and is always allocated when isOpen() is true.
FileName realDataFileName() const
This gets the file name of the file which actually contains the DN data.
void setLabelsAttached(bool attached)
Use prior to calling create, this sets whether or not to use separate label and data files.
CubeStretch readCubeStretch(QString name="CubeStretch", const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
Read a Stretch from a cube.
Statistics * 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 vario...
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube.
Camera * camera()
Return a camera associated with the cube.
FileName externalCubeFileName() const
If this is an external cube label file, this will give you the cube dn file that this label reference...
PvlGroup & group(const QString &group) const
Read a group from the cube into a Label.
double m_base
The base of the open cube or the cube that will be created; does not apply if m_pixelType is Real.
bool m_attached
True if labels are attached.
void putGroup(const PvlGroup &group)
Adds a group in a Label to the cube.
bool m_storesDnData
True (most common case) when the cube DN data is inside the file we're writing to.
bool isOpen() const
Test if a cube file has been opened/created.
void setBaseMultiplier(double base, double mult)
Used prior to the Create method, this will specify the base and multiplier for converting 8-bit/16-bi...
bool isReadOnly() const
Test if the opened cube is read-only, that is write operations will fail if this is true.
int m_lines
The line count of the open cube or the cube that will be created.
double base() const
Returns the base value for converting 8-bit/16-bit pixels to 32-bit.
void fromIsd(const FileName &fileName, Pvl &label, nlohmann::json &isd, QString access)
Initialize Cube data from a PVL label and JSON ISD.
void setMinMax(double min, double max)
Used prior to the Create method, this will compute a good base and multiplier value given the minimum...
QFile * dataFile() const
This returns the QFile with cube DN data in it.
Cube * copy(FileName newFile, const CubeAttributeOutput &newFileAttributes)
Copies the cube to the new fileName.
void create(const QString &cfile)
This method will create an isis cube for writing.
FileName * m_tempCube
If open was called with an Isis 2 cube, then this will be the name of the imported ISIS cube.
bool hasBlob(const QString &name, const QString &type)
Check to see if the cube contains a BLOB.
void cleanUp(bool remove)
This clears all of the allocated memory associated with an open cube.
ByteOrder byteOrder() const
Returns the byte order/endian-ness of the cube file.
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 ...
QFile * m_labelFile
This is the file that contains the labels always; if labels are attached then this contains the file ...
bool labelsAttached() const
Test if labels are attached.
void open(const QString &cfile, QString access="r")
This method will open an existing isis cube for reading or reading/writing.
PixelType pixelType() const
bool storesDnData() const
This method returns a boolean value.
void setVirtualBands(const QList< QString > &vbands)
This allows the programmer to specify a subset of bands to work with.
FileName * m_formatTemplateFile
Label pvl format template file (describes how to format labels)
Pvl * m_label
The label if IsOpen(), otherwise NULL.
void read(Blob &blob, const std::vector< PvlKeyword > keywords=std::vector< PvlKeyword >()) const
This method will read data from the specified Blob object.
bool isProjected() const
Returns true if the labels of the cube appear to have a valid mapping group.
OriginalLabel readOriginalLabel(const QString &name="IsisCube") const
Read the original PDS3 label from a cube.
Format
These are the possible storage formats of ISIS cubes.
@ Tile
Cubes are stored in tile format, that is the order of the pixels in the file (on disk) is BSQ within ...
@ Bsq
Cubes are stored in band-sequential format, that is the order of the pixels in the file (on disk) is:
virtual int physicalBand(const int &virtualBand) const
This method will return the physical band number given a virtual band number.
Table readTable(const QString &name)
Read a Table from the cube.
Camera * m_camera
Camera allocated from the camera() method.
bool hasGroup(const QString &group) const
Return if the cube has a specified group in the labels.
void setLabelSize(int labelBytes)
Used prior to the Create method, this will allocate a specific number of bytes in the label area for ...
OriginalXmlLabel readOriginalXmlLabel() const
Read the original PDS4 label from a cube.
virtual QString fileName() const
Returns the opened cube's filename.
void fromLabel(const FileName &fileName, Pvl &label, QString access)
Initialize Cube data from a PVL label.
virtual ~Cube()
Destroys the Cube object.
QList< int > * m_virtualBandList
If allocated, converts from physical on-disk band # to virtual band #.
void write(Blob &blob, bool overwrite=true)
This method will write a blob of data (e.g.
bool isReadWrite() const
Test if the opened cube is read-write, that is read and write operations should succeed if this is tr...
FileName * m_labelFileName
The full filename of the label file (.lbl or .cub)
void setExternalDnData(FileName cubeFileWithDnData)
Used to set external dn data to cube.
void close(bool remove=false)
Closes the cube and updates the labels.
History readHistory(const QString &name="IsisCube") const
Read the History from the Cube.
void writeLabels()
Write the Pvl labels to the cube's label file.
QMutex * m_mutex
Basic thread-safety mutex; this class is not optimized for threads.
void initCoreFromLabel(const Pvl &label)
This function initializes the Cube core from a Pvl Label passed as a parameter.
int labelSize(bool actual=false) const
Returns the number of bytes used by the label.
int m_samples
The sample count of the open cube or the cube that will be created.
void openCheck()
Throw an exception if the cube is not open.
Projection * projection()
double m_multiplier
The multiplier of the open cube or the cube that will be created; does not apply if m_pixelType is Re...
virtual int bandCount() const
Returns the number of virtual bands for the cube.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
void reopen(QString access="r")
This method will reopen an isis sube for reading or reading/writing.
Projection * m_projection
Projection allocated from the projection() method.
void setByteOrder(ByteOrder byteOrder)
Used prior to the Create method, this will specify the byte order of pixels, either least or most sig...
FileName * m_dataFileName
The full filename of the data file (.cub)
void applyVirtualBandsToLabel()
Applies virtual bands to label.
Format m_format
If isOpen() then this is the IO format that the cube uses.
Stores stretch information for a cube.
Isis::Blob toBlob() const
Serialize the CubeStretch to a Blob.
IO Handler for Isis Cubes using the tile format.
File name manipulation and expansion.
QString path() const
Returns the path of the file name.
bool fileExists() const
Returns true if the file exists; false otherwise.
FileName setExtension(const QString &extension) const
Sets all current file extensions to a new extension in the file name.
QString baseName() const
Returns the name of the file without the path and without extensions.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
static FileName createTempFile(FileName templateFileName="$TEMPORARY/temp")
Creates a temporary file and returns a FileName object created using the temporary file.
QString original() const
Returns the full file name including the file path.
QString originalPath() const
Returns the path of the original file name.
FileName removeExtension() const
Removes all extensions in the file name.
FileName addExtension(const QString &extension) const
Adds a new extension to the file name.
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Container of a cube histogram.
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Changes the range of the bins.
virtual void AddData(const double *data, const unsigned int count)
Add an array of doubles to the histogram counters.
Blob toBlob(const QString &name="IsisCube")
Converts a history object into a new blob object.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
@ Io
A type of error that occurred when performing an actual I/O operation.
Container of a cube histogram.
Create cube polygons, read/write polygons to blobs.
Blob toBlob() const
Serialize the ImagePolygon to a Blob.
Buffer manager, for moving through a cube in lines.
bool SetLine(const int line, const int band=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
Read and store original labels.
Isis::Blob toBlob()
Serialize the OriginalLabel data to a Blob.
Read and store original Xml labels.
Blob toBlob() const
Serialize the OriginalXmlLabel to a Blob.
static void RunIsisProgram(QString isisProgramName, QString arguments)
Executes the Isis program with the given arguments.
static void RunSystemCommand(QString commandLine)
This runs arbitrary system commands.
Program progress reporter.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
void CheckStatus()
Checks and updates the status.
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
Base class for Map Projections.
virtual bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
void clear()
Clears PvlKeywords.
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
QString name() const
Returns the container name.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
QString unit(const int index=0) const
Returns the units of measurement of the element of the array of values for the object at the specifie...
Contains Pvl Groups and Pvl Objects.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
PvlGroupIterator beginGroup()
Returns the beginning group index.
PvlGroup & group(const int index)
Return the group at the specified index.
int groups() const
Returns the number of groups contained.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
void deleteObject(const QString &name)
Remove an object from the current PvlObject.
int objects() const
Returns the number of objects.
PvlObject & object(const int index)
Return the object at the specified index.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
@ Traverse
Search child objects.
void addObject(const PvlObject &object)
Add a PvlObject.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
void deleteGroup(const QString &name)
Remove a group from the current PvlObject.
PvlGroupIterator endGroup()
Returns the ending group index.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
Obtain SPICE information for a spacecraft.
This class is used to accumulate statistics on double arrays.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Base class for Map TProjections.
virtual double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
virtual double UniversalLatitude()
This returns a universal latitude (planetocentric).
@ Integer
The values in the field are 4 byte integers.
@ Double
The values in the field are 8 byte doubles.
Class for storing Table blobs information.
PvlObject & Label()
The Table's label.
Blob toBlob() const
Serialze the Table to a Blob that can be written to a file.
This is free and unencumbered software released into the public domain.
ByteOrder
Tests the current architecture for byte order.
QString FileOpen(const QString &filename)
This error should be used when a file could not be opened.
This is free and unencumbered software released into the public domain.
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int toInt(const QString &string)
Global function to convert from a string to an integer.
const double ValidMaximum
The maximum valid double value for Isis pixels.
Isis::PixelType PixelTypeEnumeration(const QString &type)
Returns PixelType enumeration given a string.
@ ExternalLabel
The label is pointing to an external DN file - the label is also external to the data.
@ AttachedLabel
The input label is embedded in the image file.
@ DetachedLabel
The input label is in a separate data file from the image.
long long int BigInt
Big int.
const double ValidMinimum
The minimum valid double value for Isis pixels.
QString PixelTypeName(Isis::PixelType pixelType)
Returns string name of PixelType enumeration entered as input parameter.
PixelType
Enumerations for Isis Pixel Types.
Namespace for the standard library.
This is free and unencumbered software released into the public domain.