From 5bd7489deca8e32cd0e290cd6eb6607d61e512ac Mon Sep 17 00:00:00 2001 From: Anton Hibl <75855379+antonhibl@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:57:46 -0600 Subject: [PATCH] feature updates for tgocassisstitch (#5162) * 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 --- CHANGELOG.md | 5 ++ .../apps/tgocassisstitch/tgocassisstitch.cpp | 22 +++++++-- .../apps/tgocassisstitch/tgocassisstitch.xml | 47 ++++++++++++++++++- isis/tests/FunctionalTestsTgocassisstitch.cpp | 11 +++-- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5b5dd3cb2..6954571097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 findfeatures 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 findfeatures, 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) @@ -50,6 +52,9 @@ release. - Added two new examples demonstrating/documenting the use of FASTGEOM algorithm, parameterization using GLOBALS and creation of a regional mosaic using findfeatures. [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772) - Added new option GEOMSOURCE=BOTH to findfeatures 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 PreserveIgnoredControl via GLOBALS parameterization). [#4772](https://github.com/DOI-USGS/ISIS3/issues/4772) - Added new gtests for findfeatures that replaces all the old application tests. These tests are FunctionalTestFindfeaturesFastGeomDefault, FunctionalTestFindfeaturesFastGeomRadialConfig, FunctionalTestFindfeaturesFastGeomGridDefault and FunctionalTestFindfeaturesFastGeomGridConfig. [#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 diff --git a/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.cpp b/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.cpp index 64de84ac90..f5afc8332b 100644 --- a/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.cpp +++ b/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.cpp @@ -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(); } diff --git a/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.xml b/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.xml index ff10ca1895..5ad519c5c3 100644 --- a/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.xml +++ b/isis/src/tgo/apps/tgocassisstitch/tgocassisstitch.xml @@ -29,6 +29,15 @@ Modified stitchFrame to store the Archive group for ingested framelets. Fixes #5333. + + Modified stitchFrame to have logic for suffix or prefix in the output + filename. Fixes #5125. + + + 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. + @@ -54,11 +63,28 @@ + + cube + + input + + An optional name for the output cube. + + + An optional name for the output cube instead of the default timestamp + style naming. + + + *.cub + + + - cube + cube + output - Output ISIS cube basename. + Output ISIS cube basename prefix. The stitched cubes will be output as this basename plus the last @@ -68,6 +94,23 @@ *.cub + + + + cube + + output + + output ISIS cube basename suffix. + + + 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. + + + *.cub + diff --git a/isis/tests/FunctionalTestsTgocassisstitch.cpp b/isis/tests/FunctionalTestsTgocassisstitch.cpp index 038d351306..df0b73b237 100644 --- a/isis/tests/FunctionalTestsTgocassisstitch.cpp +++ b/isis/tests/FunctionalTestsTgocassisstitch.cpp @@ -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 args = {"fromlist=" + cubeListFile, "outputprefix=" + prefix.path() + "/CAS-MCO"}; UserInterface options(APP_XML, args); @@ -220,7 +222,10 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { QString cubeListFile = prefix.path() + "/cubelist.lis"; cubeList->write(cubeListFile); + QString cubeName = "default"; + QVector args = {"fromlist=" + cubeListFile, + "cubename=" + cubeName, "outputprefix=" + prefix.path() + "/CAS-MCO"}; UserInterface options(APP_XML, args); @@ -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 @@ -401,4 +406,4 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(hist->ValidPixels(), 100); EXPECT_NEAR(hist->StandardDeviation(), 0.063902362199265747, 0.0001); -} \ No newline at end of file +}