Skip to content

Commit

Permalink
Propagate "Cube" Format (#5737)
Browse files Browse the repository at this point in the history
* Defaulted process classes to progagate the file format

* Added changelog entry

* Appropriately propagate format from input cube or user

* Force vimscal defaultsolarcoef test output cubes to Tiled cubes
  • Loading branch information
acpaquette authored Mar 5, 2025
1 parent 6d5c7db commit 1e28c61
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ctest FunctionalTestJigsawApollo to validate this output. [#5710](https://github

### Changed
- Enhanced csminit by removing the need to specify model and plugin [#5585](https://github.com/DOI-USGS/ISIS3/issues/5585)
- Changed file format to propagate from the input image format to the output image format [#5737](https://github.com/DOI-USGS/ISIS3/pull/5737)

### Fixed
- Fixed kaguyatc2isis invalid BandBin values [#5629](https://github.com/DOI-USGS/ISIS3/issues/5629)
Expand Down
12 changes: 12 additions & 0 deletions isis/src/base/objs/CubeAttribute/CubeAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ namespace Isis {
}


bool CubeAttributeOutput::propagateFileFormat() const {
bool result = false;

QStringList fileFormatAtts = attributeList(&CubeAttributeOutput::isFileFormat);

if (fileFormatAtts.isEmpty() || fileFormatAtts.last() == "PROPAGATE")
result = true;

return result;
}


// void CubeAttributeOutput::Set(const FileName &fileName) {
// Reset();
//
Expand Down
3 changes: 3 additions & 0 deletions isis/src/base/objs/CubeAttribute/CubeAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ namespace Isis {
//! Return true if the min/max are to be propagated from an input cube
bool propagateMinimumMaximum() const;

//! Return true if the file format is to be propagated from an input cube
bool propagateFileFormat() const;

//! Return the file format an Cube::Format
Cube::Format fileFormat() const;

Expand Down
13 changes: 11 additions & 2 deletions isis/src/base/objs/Process/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,18 @@ Isis::Cube *Process::SetOutputCubeStretch(const QString &parameter, const int ns
try {
cube->setDimensions(ns, nl, nb);
cube->setByteOrder(att.byteOrder());
cube->setFormat(att.fileFormat());

// If we have an input cube and the user did not specify an output format
// propagate the input cubes format to the output cube
if(InputCubes.size() > 0 && att.propagateFileFormat()) {
cube->setFormat(InputCubes[0]->format());
}
else {
cube->setFormat(att.fileFormat());
}

cube->setLabelsAttached(att.labelAttachment());
if(att.propagatePixelType()) {
if (att.propagatePixelType()) {
if(InputCubes.size() > 0) {
cube->setPixelType(InputCubes[0]->pixelType());
}
Expand Down
10 changes: 5 additions & 5 deletions isis/src/cassini/apps/vimscal/tsts/defaultsolarcoef/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ include $(ISISROOT)/make/isismake.tsts
# the standard points for testing work correctly.
commands:
$(APPNAME) from=$(INPUT)/V1515948001_1.ir.cub \
to=$(OUTPUT)/V1515948001_1.ir.cal1.cub UNITS=IOF \
to=$(OUTPUT)/V1515948001_1.ir.cal1.cub+Tile UNITS=IOF \
IRORIGDARK=false DARK=true > /dev/null;
catlab from=$(OUTPUT)/V1515948001_1.ir.cal1.cub \
TO=$(OUTPUT)/V1515948001_1.ir.cal1.pvl > /dev/null;
$(APPNAME) from=$(INPUT)/V1515948001_1.ir.cub \
to=$(OUTPUT)/V1515948001_1.ir.cal2.cub UNITS=SPECENERGY \
to=$(OUTPUT)/V1515948001_1.ir.cal2.cub+Tile UNITS=SPECENERGY \
IRORIGDARK=false DARK=true > /dev/null;
catlab from=$(OUTPUT)/V1515948001_1.ir.cal2.cub \
TO=$(OUTPUT)/V1515948001_1.ir.cal2.pvl > /dev/null;
$(APPNAME) from=$(INPUT)/V1515948001_1.ir.cub \
to=$(OUTPUT)/V1515948001_1.ir.cal3.cub UNITS=IOF \
to=$(OUTPUT)/V1515948001_1.ir.cal3.cub+Tile UNITS=IOF \
IRORIGDARK=true DARK=true > /dev/null;
catlab from=$(OUTPUT)/V1515948001_1.ir.cal3.cub \
TO=$(OUTPUT)/V1515948001_1.ir.cal3.pvl > /dev/null;
$(APPNAME) from=$(INPUT)/V1515948001_1.ir.cub \
to=$(OUTPUT)/V1515948001_1.ir.cal4.cub UNITS=IOF \
to=$(OUTPUT)/V1515948001_1.ir.cal4.cub+Tile UNITS=IOF \
IRORIGDARK=true DARK=false > /dev/null;
catlab from=$(OUTPUT)/V1515948001_1.ir.cal4.cub \
TO=$(OUTPUT)/V1515948001_1.ir.cal4.pvl > /dev/null;
$(APPNAME) from=$(INPUT)/V1515948001_1.ir.cub \
to=$(OUTPUT)/V1515948001_1.ir.cal5.cub UNITS=IOF \
to=$(OUTPUT)/V1515948001_1.ir.cal5.cub+Tile UNITS=IOF \
IRORIGDARK=false DARK=false > /dev/null;
catlab from=$(OUTPUT)/V1515948001_1.ir.cal5.cub \
TO=$(OUTPUT)/V1515948001_1.ir.cal5.pvl > /dev/null;
Expand Down

0 comments on commit 1e28c61

Please sign in to comment.