Skip to content

Commit a3a536a

Browse files
committed
Fix ecub creation
1 parent ae8b74b commit a3a536a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

isis/src/base/objs/Cube/Cube.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -536,14 +536,15 @@ namespace Isis {
536536
core.addGroup(ptype);
537537
}
538538
else if (labelsAttached() == LabelAttachment::ExternalLabel) {
539+
imageFile = imageFile.addExtension("ecub");
539540
if (!m_dataFileName) {
540541
if (format() == Bsq || format() == Tile) {
541-
imageFile = imageFile.addExtension("cub");
542+
imageFile = imageFile.setExtension("cub");
542543

543544
Pvl dnLabel;
544545
PvlObject isiscube("IsisCube");
545546
PvlObject dnCore(core);
546-
PvlKeyword fileFormat("Format", toString(format()));
547+
PvlKeyword fileFormat("Format", CubeAttributeOutput::toString(format()));
547548

548549
dnCore.addKeyword(fileFormat);
549550
dnCore.addGroup(dims);
@@ -555,13 +556,11 @@ namespace Isis {
555556
Cube dnCube;
556557
dnCube.fromLabel(imageFile, dnLabel, "rw");
557558
dnCube.close();
558-
559-
m_dataFileName = new FileName(imageFile);
560559
}
561560
else if (format() == Format::GTiff) {
562-
imageFile = imageFile.setExtension("tiff");
563-
m_dataFileName = new FileName(imageFile);
561+
imageFile = imageFile.setExtension("tif");
564562
}
563+
m_dataFileName = new FileName(imageFile);
565564

566565
imageFile = imageFile.setExtension("ecub");
567566
FileName labelFileName(imageFile);
@@ -815,9 +814,9 @@ namespace Isis {
815814
GDALDriverH hDriver = GDALIdentifyDriver(FileName(cubeFileName).expanded().toStdString().c_str(), nullptr);
816815
bool openWithGdal = false;
817816
if (hDriver != nullptr) {
818-
GDALDriver* poDriver = (GDALDriver*)hDriver;
819-
QString driverDescription = poDriver->GetDescription();
820-
openWithGdal = driverDescription == QString("GTiff");
817+
GDALDriver* poDriver = (GDALDriver*)hDriver;
818+
QString driverDescription = poDriver->GetDescription();
819+
openWithGdal = driverDescription == QString("GTiff");
821820
}
822821

823822
try{
@@ -1241,7 +1240,9 @@ namespace Isis {
12411240
// maxbyte = position after the cube DN data and labels
12421241
streampos maxbyte = (streampos) m_labelBytes;
12431242

1244-
maxbyte += (streampos) m_ioHandler->getDataSize();
1243+
if (labelsAttached() != ExternalLabel) {
1244+
maxbyte += (streampos) m_ioHandler->getDataSize();
1245+
}
12451246

12461247
// If EOF is too early, allocate space up to where we want the blob
12471248
if (endByte < maxbyte) {

isis/src/base/objs/CubeAttribute/CubeAttribute.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ namespace Isis {
527527

528528
using CubeAttribute<CubeAttributeOutput>::toString;
529529

530+
static QString toString(Cube::Format);
530531

531532
private:
532533
bool isByteOrder(QString attribute) const;
@@ -535,8 +536,6 @@ namespace Isis {
535536
bool isPixelType(QString attribute) const;
536537
bool isRange(QString attribute) const;
537538

538-
static QString toString(Cube::Format);
539-
540539
/**
541540
* @brief Output cube range tracker
542541
*

0 commit comments

Comments
 (0)