Skip to content

Commit

Permalink
feature updates for tgocassisstitch (#5162)
Browse files Browse the repository at this point in the history
* Squashing things

added suffix and prefix capabilities in tgocassisstitch

    addresses #5125, this allows the user to optionally use either the prefix or
    suffix option when stitching frames together, just use OUTPUTSUFFIX instead
    of OUTPUTPREFIX to use it.

minor fixes

typo

more typos

close to done, one error left

    need to figure out a replacement for ui.IsOptionSet as that is not actually
    a function. I need another way to test CLLI args.

final fixes to implement ui changes

fixed

    now employs a boolean flag to decide if the name parsed with out is a suffix
    or prefix, it defaults to a prefix.

adding some tests to confirm output runs as expected.

* adding to changelog

* modified to allow prefix, suffix, both, or neither for better extensibility

    it also maintains original value names so older scripts and pipelines will
    retain functionality.

adds another optional arg, cubename

    lets the user specify an optional cubename parameter which replaces the
    timestamp style naming for the output stitched cube. If the parameter is not
    given it defaults to the timestamp style naming convention for retaining
    existing functionality.

* added details to changelog

removed debugging code

added changelog notes to xml for tgocassisstitch

* typo in changelog

* fixes from review

added cubename argument logic

typo in else statement

* modifying tests

removed faulty/old tests based on makefiles

fixed single and multi frame tests for tgocassisstitch

remaining tests fixed, one on EFS to check with jenkins.

removed debug lines

updated to remove nil randomly appearing in tests

modified first stitch test to use fallback naming behaviour.

* simplified some logic and removed repeat lines in different logic branches

removing redundant lines from 8.0 release

addresses prefix and filename convention topical issues

* resolving changelog merge conflicts (I think)

added details to changelog

small typo in link

* removed some dashes in tests and replaced a mistaken default filename

* fixing the changleog resolves

* modified to allow prefix, suffix, both, or neither for better extensibility

    it also maintains original value names so older scripts and pipelines will
    retain functionality.

* added details to changelog

changelog fixes

removed typo

* small test changes

* cleaning up git artifacts left by squashing

* changelog resolves
  • Loading branch information
antonhibl authored Aug 22, 2023
1 parent 1ba60d6 commit 5bd7489
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ release.
- Removed the `.py` extention from the _isisdataeval_ tool `isisdata_mockup` for consistency and install it in $ISISROOT/bin; added the `--tojson` and `--hasher` option to _isisdata_mockup_ tool improve utility; updated the tool `README.md` documentation to reflect this change, removed help output and trimmed example results; fixed paths to test data in `make_isisdata_mockup.sh`. [#5163](https://github.com/DOI-USGS/ISIS3/pull/5163)
- Significantly refactored FASTGEOM processing in <i>findfeatures</i> to accommodate stability and functionality. The scope of the algorithm was taken out of the ImageSource class and isolated to support this feature. [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772)
- Report better information regarding the behavior of <i>findfeatures</i>, FASTGEOM algorithms, and creation of the output network. [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772)
- Modified tgocassisstitch to optionally allow either a outputprefix or an
outputsuffix, both, or neither for naming convention purposes. [#5162](https://github.com/DOI-USGS/ISIS3/pull/5162)

### Added
- Added rclone to run dependencies in meta.yaml [#5183](https://github.com/DOI-USGS/ISIS3/issues/5183)
Expand All @@ -50,6 +52,9 @@ release.
- Added two new examples demonstrating/documenting the use of FASTGEOM algorithm, parameterization using <b>GLOBALS</b> and creation of a regional mosaic using <i>findfeatures</i>. [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772)
- Added new option <b>GEOMSOURCE=BOTH</b> to <i>findfeatures</i> to check both the MATCH and FROM/FROMLIST images for valid control measure geometry to produce better networks and prevent downstream processing errors. Ignore points that end up with no valid measures (but can be retained with use of <b>PreserveIgnoredControl</b> via GLOBALS parameterization). [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772)
- Added new gtests for <i>findfeatures</i> that replaces all the old application tests. These tests are <i>FunctionalTestFindfeaturesFastGeomDefault</i>, <i>FunctionalTestFindfeaturesFastGeomRadialConfig</i>, <i>FunctionalTestFindfeaturesFastGeomGridDefault</i> and <i>FunctionalTestFindfeaturesFastGeomGridConfig</i>. [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772)
- Added an optional cubename parameter to tgocassisstitch which lets the user
override the timestamp style naming convention of the output cube with their
own name; if not specified retains existing behavior [#5125](https://github.com/USGS-Astrogeology/ISIS3/issues/5162)

### Deprecated

Expand Down
22 changes: 19 additions & 3 deletions isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,34 @@ namespace Isis {
throw IException(e, IException::Unknown, msg, _FILEINFO_);
}

// read the optional cubename
FileName frameletCubeFlag(ui.GetCubeName("CUBENAME"));
QString frameletCubeName = frameletCubeFlag.expanded();

// Stitch together the individual frames
FileName outputFileName(ui.GetCubeName("OUTPUTPREFIX"));
QString outputBaseName = outputFileName.expanded();
FileName outputPrefix(ui.GetCubeName("OUTPUTPREFIX"));
FileName outputSuffix(ui.GetCubeName("OUTPUTSUFFIX"));
QString outputPrefBaseName = outputPrefix.expanded();
QString outputSuffBaseName = outputSuffix.expanded();
QStringList frameKeys = frameMap.uniqueKeys();
Progress stitchProgress;
stitchProgress.SetText("Stitching Frames");
stitchProgress.SetMaximumSteps(frameKeys.size());
stitchProgress.CheckStatus();

foreach(QString frameKey, frameKeys) {
try {
QString frameIdentifier = frameKey.split("/").last();
FileName frameFileName(outputBaseName + "-" + frameIdentifier + ".cub");
FileName frameFileName;
if (frameletCubeName != "") {
frameFileName = FileName(outputPrefBaseName + "-" +
frameletCubeName +
outputSuffBaseName + ".cub");
} else {
frameFileName = FileName(outputPrefBaseName + "-" +
frameIdentifier +
outputSuffBaseName + ".cub");
}
stitchFrame( frameMap.values(frameKey), frameFileName );
stitchProgress.CheckStatus();
}
Expand Down
47 changes: 45 additions & 2 deletions isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
<change name="Adam Goins" date="2018-02-15">
Modified stitchFrame to store the Archive group for ingested framelets. Fixes #5333.
</change>
<change name="Anton Hibl" date="2023-02-24">
Modified stitchFrame to have logic for suffix or prefix in the output
filename. Fixes #5125.
</change>
<change name="Anton Hibl" date="2023-03-01">
Added an optional argument to tgocassisstitch which allows for an optional
cubename to override the default timestamp-style naming convention and
bahavior for the output cube. Fixes #5125.
</change>
</history>

<category>
Expand All @@ -54,11 +63,28 @@
</filter>
</parameter>

<parameter name="CUBENAME">
<type>cube</type>
<default><item></item></default>
<fileMode>input</fileMode>
<brief>
An optional name for the output cube.
</brief>
<description>
An optional name for the output cube instead of the default timestamp
style naming.
</description>
<filter>
*.cub
</filter>
</parameter>

<parameter name="OUTPUTPREFIX">
<type>cube</type>
<type>cube</type>
<default><item></item></default>
<fileMode>output</fileMode>
<brief>
Output ISIS cube basename.
Output ISIS cube basename prefix.
</brief>
<description>
The stitched cubes will be output as this basename plus the last
Expand All @@ -68,6 +94,23 @@
<filter>
*.cub
</filter>
</parameter>

<parameter name="OUTPUTSUFFIX">
<type>cube</type>
<default><item></item></default>
<fileMode>output</fileMode>
<brief>
output ISIS cube basename suffix.
</brief>
<description>
The stitched cubes will be output as the last component of the serial
number plus this basename. Usually this will be the start time for
the frame.
</description>
<filter>
*.cub
</filter>
</parameter>
</group>
</groups>
Expand Down
11 changes: 8 additions & 3 deletions isis/tests/FunctionalTestsTgocassisstitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) {
cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.16.833-RED-01006-B1_crop.cub");
cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.16.833-NIR-02006-B1_crop.cub");
cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.16.833-PAN-00006-B1_crop.cub");

QString cubeListFile = prefix.path() + "/cubelist.lis";
cubeList->write(cubeListFile);

QString cubeName = "default";

QVector<QString> args = {"fromlist=" + cubeListFile,
"outputprefix=" + prefix.path() + "/CAS-MCO"};
UserInterface options(APP_XML, args);
Expand Down Expand Up @@ -220,7 +222,10 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) {
QString cubeListFile = prefix.path() + "/cubelist.lis";
cubeList->write(cubeListFile);

QString cubeName = "default";

QVector<QString> args = {"fromlist=" + cubeListFile,
"cubename=" + cubeName,
"outputprefix=" + prefix.path() + "/CAS-MCO"};
UserInterface options(APP_XML, args);

Expand All @@ -231,7 +236,7 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) {
FAIL() << "Unable to run tgocassisstitch with cube list: " << e.what() << std::endl;
}

Cube cube(prefix.path() + "/CAS-MCO-2016-11-22T16:16:10.833.cub");
Cube cube(prefix.path() + "/CAS-MCO-default.cub");
Pvl *isisLabel = cube.label();

// Dimensions Group
Expand Down Expand Up @@ -401,4 +406,4 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) {
EXPECT_EQ(hist->ValidPixels(), 100);
EXPECT_NEAR(hist->StandardDeviation(), 0.063902362199265747, 0.0001);

}
}

0 comments on commit 5bd7489

Please sign in to comment.