23 #include "IsisDebug.h" 70 Cube::Cube(
const FileName &fileName, QString access) {
90 delete m_formatTemplateFile;
91 m_formatTemplateFile = NULL;
100 bool Cube::isOpen()
const {
101 bool open = (m_ioHandler != NULL);
103 ASSERT(open == (
bool)m_labelFile);
104 ASSERT(open == (
bool)m_labelFileName);
105 ASSERT(open == (
bool)m_label);
119 bool Cube::isProjected()
const {
120 return label()->findObject(
"IsisCube").hasGroup(
"Mapping");
130 bool Cube::isReadOnly()
const {
131 bool readOnly =
false;
134 QString msg =
"No cube opened";
138 if ((m_labelFile->openMode() & QIODevice::ReadWrite) != QIODevice::ReadWrite)
152 bool Cube::isReadWrite()
const {
153 return !isReadOnly();
165 bool Cube::labelsAttached()
const {
177 void Cube::close(
bool removeIt) {
178 if (isOpen() && isReadWrite())
196 QObject::tr(
"Cube::copy requires the originating cube to be open"),
204 result->
setDimensions(sampleCount(), lineCount(), bandCount());
223 else if(result->
pixelType() >= pixelType()) {
228 QObject::tr(
"Cannot reduce the output PixelType for [%1] from [%2] without output " 229 "pixel range").arg(newFile.
original()).arg(fileName());
243 m_ioHandler->clearCache(
true);
254 for(
int i = 0; i < isisCube.
groups(); i++) {
258 if (label()->hasObject(
"NaifKeywords")) {
260 label()->findObject(
"NaifKeywords"));
263 for (
int i = 0; i < m_label->objects(); i++) {
277 BufferManager output(sampleCount(), lineCount(), bandCount(),
284 while (!input.
end()) {
286 output.Copy(input,
false);
288 result->
write(output);
331 void Cube::create(
const QString &cubeFileName) {
334 string msg =
"You already have a cube opened";
338 if (m_samples < 1 || m_lines < 1 || m_bands < 1) {
339 QString msg =
"Number of samples [" +
toString(m_samples) +
341 "] cannot be less than 1";
345 if (m_pixelType == None) {
347 QString(
"Cannot create the cube [%1] with a pixel type set to None")
352 if (m_storesDnData) {
361 int maxSizePreference = 0;
364 Preference::Preferences().findGroup(
"CubeCustomization")[
"MaximumSize"];
366 if (size > maxSizePreference) {
368 msg +=
"The cube you are attempting to create [" + cubeFileName +
"] is [" 369 +
toString(size) +
"GB]. This is larger than the current allowed " 370 "size of [" +
toString(maxSizePreference) +
"GB]. The cube " 371 "dimensions were (S,L,B) [" +
toString(m_samples) +
", " +
373 toString(
SizeOf(m_pixelType)) +
"] bytes per pixel. If you still " 374 "wish to create this cube, the maximum value can be changed in your personal " 375 "preference file located in [~/.Isis/IsisPreferences] within the group " 376 "CubeCustomization, keyword MaximumSize. If you do not have an ISISPreference file, " 377 "please refer to the documentation \"Environment and Preference Setup\". Error ";
387 if (m_storesDnData) {
394 m_labelFileName =
new FileName(cubFile);
395 m_dataFileName =
new FileName(cubFile);
396 m_labelFile =
new QFile(m_labelFileName->expanded());
401 m_dataFileName =
new FileName(cubFile);
402 m_dataFile =
new QFile(realDataFileName().expanded());
406 m_labelFileName =
new FileName(labelFileName);
407 m_labelFile =
new QFile(m_labelFileName->expanded());
422 ptype +=
PvlKeyword(
"ByteOrder", ByteOrderName(m_byteOrder));
430 ASSERT(m_dataFileName);
432 core +=
PvlKeyword(
"^DnFile", m_dataFileName->original());
434 m_dataFile =
new QFile(realDataFileName().expanded());
436 m_labelFileName =
new FileName(cubFile);
437 m_labelFile =
new QFile(cubFile.
expanded());
448 m_label->addObject(lbl);
451 Preference::Preferences().findGroup(
"CubeCustomization");
452 bool overwrite = pref[
"Overwrite"][0].toUpper() ==
"ALLOW";
453 if (!overwrite && m_labelFile->exists() && m_labelFile->size()) {
454 QString msg =
"Cube file [" + m_labelFileName->original() +
"] exists, " +
455 "user preference does not allow overwrite";
459 if (!m_labelFile->open(QIODevice::Truncate | QIODevice::ReadWrite)) {
460 QString msg =
"Failed to create [" + m_labelFile->fileName() +
"]. ";
461 msg +=
"Verify the output path exists and you have permission to write to the path.";
467 if (m_storesDnData && !m_dataFile->open(QIODevice::Truncate | QIODevice::ReadWrite)) {
468 QString msg =
"Failed to create [" + m_dataFile->fileName() +
"]. ";
469 msg +=
"Verify the output path exists and you have permission to write to the path.";
473 else if (!m_storesDnData && !m_dataFile->open(QIODevice::ReadOnly)) {
474 QString msg =
"Failed to open [" + m_dataFile->fileName() +
"] for reading. ";
475 msg +=
"Verify the output path exists and you have permission to read from the path.";
481 bool dataAlreadyOnDisk = m_storesDnData ? false :
true;
483 if (m_format == Bsq) {
484 m_ioHandler =
new CubeBsqHandler(dataFile(), m_virtualBandList, realDataFileLabel(),
488 m_ioHandler =
new CubeTileHandler(dataFile(), m_virtualBandList, realDataFileLabel(),
493 m_ioHandler->updateLabels(*m_label);
532 create(cubeFileName);
544 void Cube::open(
const QString &cubeFileName, QString access) {
548 string msg =
"You already have a cube opened";
552 initLabelFromFile(cubeFileName, (access ==
"rw"));
562 m_dataFileName =
new FileName(m_labelFileName->path() +
"/" + temp.
original());
565 m_dataFileName =
new FileName(temp);
569 m_storesDnData =
true;
571 m_dataFile =
new QFile(realDataFileName().expanded());
575 FileName dataFileName(core[
"^DnFile"][0]);
578 m_dataFileName =
new FileName(m_labelFileName->path() +
"/" + dataFileName.
name());
581 m_dataFileName =
new FileName(dataFileName);
585 m_storesDnData =
false;
586 *m_dataFileName =
FileName(realDataFileName().expanded());
587 m_dataFile =
new QFile(realDataFileName().expanded());
591 m_dataFileName =
new FileName(*m_labelFileName);
593 m_storesDnData =
true;
602 if (!m_labelFile->open(QIODevice::ReadOnly)) {
603 QString msg =
"Failed to open [" + m_labelFile->fileName() +
"] with " 610 if (!m_dataFile->open(QIODevice::ReadOnly)) {
611 QString msg =
"Failed to open [" + m_dataFile->fileName() +
"] with " 619 else if (access ==
"rw") {
620 if (!m_labelFile->open(QIODevice::ReadWrite)) {
621 QString msg =
"Failed to open [" + m_labelFile->fileName() +
"] with " 628 if (m_storesDnData && !m_dataFile->open(QIODevice::ReadWrite)) {
629 QString msg =
"Failed to open [" + m_dataFile->fileName() +
"] with " 634 else if (!m_storesDnData && !m_dataFile->open(QIODevice::ReadOnly)) {
635 QString msg =
"Failed to open [" + m_dataFile->fileName() +
"] with " 643 QString msg =
"Unknown value for access [" + access +
"]. Expected 'r' " 649 initCoreFromLabel(*m_label);
653 m_labelBytes = m_label->findObject(
"Label")[
"Bytes"];
656 m_labelBytes = labelSize(
true);
660 if (!m_storesDnData) {
661 dataLabel = qMakePair(
true,
new Pvl(m_dataFileName->expanded()));
665 if (m_format == Bsq) {
667 realDataFileLabel(),
true);
671 realDataFileLabel(),
true);
674 if (dataLabel.first) {
675 delete dataLabel.second;
676 dataLabel.second = NULL;
679 applyVirtualBandsToLabel();
691 void Cube::reopen(QString access) {
693 QString msg =
"Cube has not been opened yet. The filename to re-open is " 699 FileName filename = *m_labelFileName;
702 if (m_virtualBandList)
703 virtualBandList = *m_virtualBandList;
708 if (virtualBandList.size()) {
709 if (m_virtualBandList)
710 *m_virtualBandList = virtualBandList;
712 m_virtualBandList =
new QList<int>(virtualBandList);
724 void Cube::read(
Blob &blob)
const {
726 string msg =
"The cube is not opened so you can't read a blob from it";
730 FileName cubeFile = *m_labelFileName;
732 cubeFile = *m_tempCube;
734 QMutexLocker locker(m_mutex);
735 QMutexLocker locker2(m_ioHandler->dataFileMutex());
746 void Cube::read(
Buffer &bufferToFill)
const {
748 string msg =
"Try opening a file before you read it";
752 QMutexLocker locker(m_mutex);
753 m_ioHandler->read(bufferToFill);
765 string msg =
"The cube is not opened so you can't write a blob to it";
769 if (!m_labelFile->isWritable()) {
770 string msg =
"The cube must be opened in read/write mode, not readOnly";
776 QMutexLocker locker(m_mutex);
777 QMutexLocker locker2(m_ioHandler->dataFileMutex());
781 fstream stream(m_labelFileName->expanded().toLatin1().data(),
782 ios::in | ios::out | ios::binary);
783 stream.seekp(0, ios::end);
786 streampos endByte = stream.tellp();
788 streampos maxbyte = (streampos) m_labelBytes;
790 if (m_storesDnData) {
791 maxbyte += (streampos) m_ioHandler->getDataSize();
795 if (endByte < maxbyte) {
796 stream.seekp(maxbyte, ios::beg);
799 blob.
Write(*m_label, stream);
808 QString blobFile(blobFileName.
expanded());
809 ios::openmode flags = ios::in | ios::binary | ios::out | ios::trunc;
810 fstream detachedStream;
811 detachedStream.open(blobFile.toLatin1().data(), flags);
812 if (!detachedStream) {
813 QString message =
"Unable to open data file [" +
822 blob.
Write(*m_label, detachedStream, blobFileName.
name());
833 void Cube::write(
Buffer &bufferToWrite) {
835 string msg =
"Tried to write to a cube before opening/creating it";
840 QString msg =
"Cannot write to the cube [" + (QString)QFileInfo(fileName()).fileName() +
841 "] because it is opened read-only";
845 if (!m_storesDnData) {
846 QString msg =
"The cube [" + QFileInfo(fileName()).fileName() +
847 "] does not support storing DN data because it is using an external file for DNs";
851 QMutexLocker locker(m_mutex);
852 m_ioHandler->write(bufferToWrite);
866 void Cube::setBaseMultiplier(
double base,
double mult) {
883 void Cube::setMinMax(
double min,
double max) {
890 if (m_pixelType == UnsignedByte) {
893 m_multiplier = (max - min) / (x2 - x1);
894 m_base = min - m_multiplier * x1;
896 else if (m_pixelType == SignedWord) {
899 m_multiplier = (max - min) / (x2 - x1);
900 m_base = min - m_multiplier * x1;
902 else if (m_pixelType == UnsignedWord) {
905 m_multiplier = (max - min) / (x2 - x1);
906 m_base = min - m_multiplier * x1;
919 m_byteOrder = byteOrder;
932 void Cube::setDimensions(
int ns,
int nl,
int nb) {
934 if ((ns < 1) || (nl < 1) || (nb < 1)) {
935 string msg =
"SetDimensions: Invalid number of sample, lines or bands";
949 void Cube::setExternalDnData(
FileName cubeFileWithDnData) {
951 initLabelFromFile(cubeFileWithDnData,
false);
952 initCoreFromLabel(*m_label);
963 m_storesDnData =
false;
964 m_dataFileName =
new FileName(cubeFileWithDnData);
969 delete m_labelFileName;
970 m_labelFileName = NULL;
993 void Cube::setLabelsAttached(
bool attach) {
1006 void Cube::setLabelSize(
int labelBytes) {
1008 m_labelBytes = labelBytes;
1021 m_pixelType = pixelType;
1038 if (m_virtualBandList)
1039 m_virtualBandList->clear();
1043 if (vbands.size() > 0) {
1044 QListIterator<QString> it(vbands);
1045 while (it.hasNext()) {
1046 m_virtualBandList->append(
toInt(it.next()));
1050 delete m_virtualBandList;
1051 m_virtualBandList = NULL;
1055 m_ioHandler->setVirtualBands(m_virtualBandList);
1066 void Cube::setVirtualBands(
const std::vector<QString> &vbands) {
1069 for(
unsigned int i = 0; i < vbands.size(); i++)
1070 realVBands << vbands[i];
1072 setVirtualBands(realVBands);
1084 QString(
"Cannot relocate the DN data to [%1] for an external cube label " 1085 "file which is not open.")
1091 if (m_storesDnData) {
1093 QString(
"The cube [%1] stores DN data. It cannot be relocated to [%2] - " 1094 "this is only supported for external cube label files.")
1095 .arg(m_labelFileName->original()).arg(dnDataFile.
original()),
1099 m_label->findObject(
"IsisCube").findObject(
"Core").findKeyword(
"^DnFile")[0] =
1101 reopen(m_labelFile->isWritable()?
"rw" :
"r");
1125 int Cube::bandCount()
const {
1126 int numBands = m_bands;
1127 if (m_virtualBandList)
1128 numBands = m_virtualBandList->size();
1142 double Cube::base()
const {
1167 if (m_camera == NULL && isOpen()) {
1168 m_camera = CameraFactory::Create(*
this);
1183 "An external cube label file must be opened in order to use " 1184 "Cube::getExternalCubeFileName",
1188 if (storesDnData()) {
1190 "Cube::getExternalCubeFileName can only be called on an external cube label " 1198 return core[
"^DnFile"][0];
1208 QString Cube::fileName()
const {
1210 return m_labelFileName->expanded();
1274 Histogram *Cube::histogram(
const int &band,
const double &validMin,
1275 const double &validMax, QString msg) {
1278 QString msg =
"Cannot create histogram object for an unopened cube";
1283 if ((band < 0) || (band > bandCount())) {
1284 QString msg =
"Invalid band in [CubeInfo::Histogram]";
1288 int bandStart = band;
1289 int bandStop = band;
1290 int maxSteps = lineCount();
1293 bandStop = bandCount();
1294 maxSteps = lineCount() * bandCount();
1306 double binMin = validMin;
1307 double binMax = validMax;
1309 binMin = hist->BinRangeStart();
1313 binMax = hist->BinRangeEnd();
1324 for(
int useBand = bandStart ; useBand <= bandStop ; useBand++) {
1325 for(
int i = 1; i <= lineCount(); i++) {
1358 int Cube::labelSize(
bool actual)
const {
1359 int labelSize = m_labelBytes;
1361 if (actual && m_label) {
1363 s << *m_label << endl;
1364 labelSize = s.tellp();
1379 int Cube::lineCount()
const {
1393 double Cube::multiplier()
const {
1394 return m_multiplier;
1418 int Cube::physicalBand(
const int &virtualBand)
const {
1419 int physicalBand = virtualBand;
1421 if (m_virtualBandList) {
1422 if ((virtualBand < 1) ||
1423 (virtualBand > m_virtualBandList->size())) {
1424 QString msg =
"Out of array bounds [" +
toString(virtualBand) +
"]";
1427 physicalBand = m_virtualBandList->at(virtualBand - 1);
1430 return physicalBand;
1440 if (m_projection == NULL && isOpen()) {
1441 m_projection = ProjectionFactory::CreateFromCube(*label());
1443 return m_projection;
1452 int Cube::sampleCount()
const {
1496 Statistics *Cube::statistics(
const int &band,
const double &validMin,
1497 const double &validMax, QString msg) {
1500 QString msg =
"Cannot create statistics object for an unopened cube";
1505 if ((band < 0) || (band > bandCount())) {
1506 string msg =
"Invalid band in [CubeInfo::Statistics]";
1514 stats->SetValidRange(validMin, validMax);
1516 int bandStart = band;
1517 int bandStop = band;
1518 int maxSteps = lineCount();
1521 bandStop = bandCount();
1522 maxSteps = lineCount() * bandCount();
1531 for(
int useBand = bandStart ; useBand <= bandStop ; useBand++) {
1532 for(
int i = 1; i <= lineCount(); i++) {
1549 bool Cube::storesDnData()
const {
1550 return m_storesDnData;
1569 if (isOpen() && m_ioHandler) {
1570 m_ioHandler->addCachingAlgorithm(algorithm);
1572 else if (!isOpen()) {
1573 QString msg =
"Cannot add a caching algorithm until the cube is open";
1583 void Cube::clearIoCache() {
1585 QMutexLocker locker(m_mutex);
1586 m_ioHandler->clearCache();
1600 bool Cube::deleteBlob(QString BlobType, QString BlobName) {
1601 for(
int i = 0; i < m_label->objects(); i++) {
1603 if (obj.
name().compare(BlobType) == 0) {
1622 void Cube::deleteGroup(
const QString &group) {
1624 if (!isiscube.
hasGroup(group))
return;
1649 bool Cube::hasGroup(
const QString &group)
const {
1651 if (isiscube.
hasGroup(group))
return true;
1663 bool Cube::hasTable(
const QString &name) {
1664 for(
int o = 0; o < label()->objects(); o++) {
1668 QString temp = (QString) obj[
"Name"];
1669 temp = temp.toUpper();
1670 QString temp2 = name;
1671 temp2 = temp2.toUpper();
1672 if (temp == temp2)
return true;
1690 QString msg =
"Cannot add a group to the label of cube [" + (QString)QFileInfo(fileName()).fileName() +
1691 "] because it is opened read-only";
1710 void Cube::applyVirtualBandsToLabel() {
1714 if (m_label->findObject(
"IsisCube").hasGroup(
"BandBin")) {
1715 PvlGroup &bandBin = m_label->findObject(
"IsisCube").findGroup(
"BandBin");
1716 for (
int k = 0;k < bandBin.
keywords();k++) {
1717 if (bandBin[k].size() == m_bands && m_virtualBandList) {
1720 for (
int i = 0;i < m_virtualBandList->size();i++) {
1721 int physicalBand = m_virtualBandList->at(i) - 1;
1722 bandBin[k].addValue(temp[physicalBand], temp.
unit(physicalBand));
1729 if (m_virtualBandList && core.
hasGroup(
"Dimensions")) core.
findGroup(
"Dimensions")[
"Bands"] =
toString(m_virtualBandList->size());
1738 void Cube::cleanUp(
bool removeIt) {
1746 QFile::remove(m_tempCube->expanded());
1754 QFile::remove(m_labelFileName->expanded());
1756 if (*m_labelFileName != *m_dataFileName)
1757 QFile::remove(m_dataFileName->expanded());
1766 delete m_labelFileName;
1767 m_labelFileName = NULL;
1769 delete m_dataFileName;
1770 m_dataFileName = NULL;
1775 delete m_virtualBandList;
1776 m_virtualBandList = NULL;
1786 void Cube::construct() {
1793 m_projection = NULL;
1795 m_labelFileName = NULL;
1796 m_dataFileName = NULL;
1798 m_formatTemplateFile = NULL;
1801 m_virtualBandList = NULL;
1803 m_mutex =
new QMutex();
1804 m_formatTemplateFile =
1805 new FileName(
"$base/templates/labels/CubeFormatTemplate.pft");
1817 QFile *Cube::dataFile()
const {
1836 if (m_attached && m_storesDnData) {
1837 ASSERT(m_labelFileName);
1838 result = *m_labelFileName;
1841 else if (!m_attached && m_storesDnData) {
1842 ASSERT(m_dataFileName);
1843 result = *m_dataFileName;
1846 else if (!m_storesDnData) {
1847 ASSERT(m_dataFileName);
1854 if (dir.isRelative() && m_labelFileName) {
1855 QDir dir2(m_labelFileName->originalPath());
1856 dir2.cd(guess.
path());
1857 guess = dir2.absolutePath() +
"/" + guess.
name();
1864 if (core.hasKeyword(
"^DnFile")) {
1866 guess = core[
"^DnFile"][0];
1868 if (!guess.
path().startsWith(
"/")) {
1872 else if (core.hasKeyword(
"^Core")) {
1873 result = core[
"^Core"][0];
1879 while (result.
name() ==
"");
1897 void Cube::initialize() {
1905 m_storesDnData =
true;
1906 m_labelBytes = 65536;
1922 void Cube::initCoreFromLabel(
const Pvl &label) {
1928 m_samples = dims[
"Samples"];
1929 m_lines = dims[
"Lines"];
1930 m_bands = dims[
"Bands"];
1934 m_byteOrder = ByteOrderEnumeration(pixelsGroup[
"ByteOrder"]);
1935 m_base = pixelsGroup[
"Base"];
1936 m_multiplier = pixelsGroup[
"Multiplier"];
1940 if ((QString) core[
"Format"] ==
"BandSequential") {
1949 if (!temp.
expanded().startsWith(
"/")) {
1966 void Cube::initLabelFromFile(
FileName labelFileName,
bool readWrite) {
1967 ASSERT(!m_labelFileName);
1972 if (!m_label->objects()) {
1990 if (!m_label->objects()) {
1993 labelFileName = tmp;
2010 if (!m_label->objects()) {
2013 labelFileName = tmp;
2030 if (!m_label->objects()) {
2033 labelFileName = tmp;
2049 m_labelFileName =
new FileName(labelFileName);
2053 if (m_label->hasKeyword(
"CCSD3ZF0000100000001NJPL3IF0PDS200000001")) {
2055 reformatOldIsisLabel(m_labelFileName->expanded());
2058 QString msg =
"Can not open [" + m_labelFileName->original() +
"]" 2059 " because it is an ISIS2 cube.";
2065 m_labelFile =
new QFile(m_labelFileName->expanded());
2073 void Cube::openCheck() {
2075 string msg =
"Sorry you can't do a SetMethod after the cube is opened";
2086 Pvl Cube::realDataFileLabel()
const {
2087 Pvl label = *m_label;
2091 core = &label.
findObject(
"IsisCube").findObject(
"Core");
2095 FileName temp((*core)[
"^DnFile"][0]);
2096 if (!temp.
expanded().startsWith(
"/")) {
2097 temp = realDataFileName();
2116 void Cube::reformatOldIsisLabel(
const QString &oldCube) {
2117 QString parameters =
"from=" + oldCube;
2119 FileName tempCube = FileName::createTempFile(
"Temporary_" + oldName.
name() +
".cub");
2120 parameters +=
" to=" + tempCube.
expanded();
2123 QString command =
"$ISISROOT/bin/pds2isis " + parameters;
2124 ProgramLauncher::RunSystemCommand(command);
2127 QString prog =
"pds2isis";
2128 ProgramLauncher::RunIsisProgram(prog, parameters);
2131 m_tempCube =
new FileName(tempCube);
2132 *m_label =
Pvl(m_tempCube->toString());
2133 m_labelFile =
new QFile(m_tempCube->expanded());
2146 void Cube::latLonRange(
double &minLatitude,
double &maxLatitude,
double &minLongitude,
double &
2151 bool isGood =
false;
2152 bool useProj =
true;
2154 if (hasGroup(
"Instrument")) {
2164 QString msg =
"Cannot calculate lat/lon range without a camera or projection";
2173 QString msg =
"Unable to create camera when calculating a lat/lon range.";
2179 minLatitude = 99999;
2180 minLongitude = 99999;
2181 maxLatitude = -99999;
2182 maxLongitude = -99999;
2184 for (
double sample = 0.5; sample < sampleCount() + 0.5; sample++) {
2186 for (
double line = 0.5; line < lineCount() + 0.5; line++) {
2188 isGood = proj->
SetWorld(sample, line);
2191 isGood = cam->
SetImage(sample, line);
2206 if (lat < minLatitude) {
2209 else if (lat > maxLatitude) {
2213 if (lon < minLongitude) {
2216 else if (lon > maxLongitude) {
2222 if ( (minLatitude == 99999) || (minLongitude == 99999) || (maxLatitude == -99999) ||
2223 (maxLongitude == -99999) ) {
2224 QString msg =
"Unable to calculate a minimum or maximum latitutde or longitude.";
2233 void Cube::writeLabels() {
2235 string msg =
"Cube must be opened first before writing labels";
2240 m_label->setFormatTemplate(m_formatTemplateFile->original());
2244 QMutexLocker locker(m_mutex);
2245 QMutexLocker locker2(m_ioHandler->dataFileMutex());
2248 temp << *m_label << endl;
2249 string tempstr = temp.str();
2250 if ((
int) tempstr.length() < m_labelBytes) {
2251 QByteArray labelArea(m_labelBytes,
'\0');
2252 QByteArray labelUnpaddedContents(tempstr.c_str(), tempstr.length());
2253 labelArea.replace(0, labelUnpaddedContents.size(), labelUnpaddedContents);
2255 m_labelFile->seek(0);
2256 m_labelFile->write(labelArea);
2260 QString msg =
"Label space is full in [" +
2262 "] unable to write labels";
2270 m_label->write(m_labelFileName->expanded());
PvlObject & object(const int index)
Return the object at the specified index.
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...
Buffer for reading and writing cube data.
long long int BigInt
Big int.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the histogram counters.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
QString path() const
Returns the path of the file name.
double * DoubleBuffer() const
Returns the value of the shape buffer.
The label is pointing to an external DN file - the label is also external to the data.
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...
PixelType pixelType() const
Return the pixel type as an Isis::PixelType.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
ByteOrder byteOrder() const
Return the byte order as an Isis::ByteOrder.
const double ValidMinimum
The minimum valid double value for Isis pixels.
File name manipulation and expansion.
IO Handler for Isis Cubes using the BSQ format.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
void Read(const QString &file)
This method reads Pvl values from a specified file.
Base class for Map TProjections.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
FileName addExtension(const QString &extension) const
Adds a new extension to the file name.
void Write(const QString &file)
Write the blob data out to a file.
int toInt(const QString &string)
Global function to convert from a string to an integer.
QString PixelTypeName(Isis::PixelType pixelType)
Returns string name of PixelType enumeration entered as input parameter.
void setFormat(Format format)
Used prior to the Create method, this will specify the format of the cube, either band...
Namespace for the standard library.
ByteOrder
Tests the current architecture for byte order.
bool propagatePixelType() const
Return true if the pixel type is to be propagated from an input cube.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
double UniversalLongitude()
This returns a universal longitude (positive east in 0 to 360 domain).
void setLabelsAttached(bool attached)
Use prior to calling create, this sets whether or not to use separate label and data files...
bool propagateMinimumMaximum() const
Return true if the min/max are to be propagated from an input cube.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
QString originalPath() const
Returns the path of the original file name.
void deleteGroup(const QString &name)
Remove a group from the current PvlObject.
void CheckStatus()
Checks and updates the status.
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube.
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 ...
int size() const
Returns the total number of pixels in the shape buffer.
PixelType
Enumerations for Isis Pixel Types.
bool begin()
Moves the shape buffer to the first position.
void addObject(const PvlObject &object)
Add a PvlObject.
Buffer manager, for moving through a cube in lines.
QString name() const
Returns the container name.
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
This class is used to accumulate statistics on double arrays.
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Changes the range of the bins.
The input label is in a separate data file from the image.
Isis::PixelType PixelTypeEnumeration(const QString &type)
Returns PixelType enumeration given a string.
Base class for Map Projections.
Program progress reporter.
void setPixelType(PixelType pixelType)
Used prior to the Create method, this will specify the output pixel type.
Container of a cube histogram.
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Manages a Buffer over a cube.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
bool next()
Moves the shape buffer to the next position.
Manipulate and parse attributes of output cube filenames.
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...
A single keyword-value pair.
double maximum() const
Return the output cube attribute maximum.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
QString original() const
Returns the full file name including the file path.
The input label is embedded in the image file.
Cube::Format fileFormat() const
Return the file format an Cube::Format.
IO Handler for Isis Cubes using the tile format.
bool end() const
Returns true if the shape buffer has accessed the end of the cube.
Container for cube-like labels.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
PixelType pixelType() const
void deleteObject(const QString &name)
Remove an object from the current PvlObject.
void setByteOrder(ByteOrder byteOrder)
Used prior to the Create method, this will specify the byte order of pixels, either least or most sig...
double UniversalLatitude()
This returns a universal latitude (planetocentric).
bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
QString Name() const
Accessor method that returns a string containing the Blob name.
PvlGroup & group(const int index)
Return the group at the specified index.
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
void setMinMax(double min, double max)
Used prior to the Create method, this will compute a good base and multiplier value given the minimum...
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
const double ValidMaximum
The maximum valid double value for Isis pixels.
void write(Blob &blob)
This method will write a blob of data (e.g.
FileName setExtension(const QString &extension) const
Sets all current file extensions to a new extension in the file name.
Namespace for ISIS/Bullet specific routines.
void setExternalDnData(FileName cubeFileWithDnData)
Used to set external dn data to cube.
QString FileOpen(const QString &filename)
This error should be used when a file could not be opened.
int groups() const
Returns the number of groups contained.
double minimum() const
Return the output cube attribute minimum.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Contains Pvl Groups and Pvl Objects.
void create(const QString &cfile)
This method will create an isis cube for writing.
Format
These are the possible storage formats of Isis3 cubes.
QString Type() const
Accessor method that returns a string containing the Blob type.
This is the parent of the caching algorithms
void clear()
Clears PvlKeywords.
bool fileExists() const
Returns true if the file exists; false otherwise.
void setLabelSize(int labelBytes)
Used prior to the Create method, this will allocate a specific number of bytes in the label area for ...
FileName removeExtension() const
Removes all extensions in the file name.
IO Handler for Isis Cubes.