Skip to content

Commit

Permalink
manually added oglab onto HRSC stereo images, removed unsued function…
Browse files Browse the repository at this point in the history
…s in hrsc2isis (#4892)

* manually added oglab onto stereo image, removed unsued funcs

* added tests and changelog
  • Loading branch information
Kelvinrr authored and jessemapel committed Apr 14, 2022
1 parent 6b3af4b commit faf913d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Keywords when running CAMSTATS. [#3605](https://github.com/USGS-Astrogeology/IS
- Fixed slow runs of automos when the priority was BAND. [#4793](https://github.com/USGS-Astrogeology/ISIS3/pull/4793)
- Fixed qview crashing when attempting to load image DNs. [4818](https://github.com/USGS-Astrogeology/ISIS3/issues/4818)
- Modified cnetcheck noLatLonCheck logic to correctly exclude ignored measures. [#4649](https://github.com/USGS-Astrogeology/ISIS3/issues/4649)
- Fixed bug where the original label was not attached to stereo HRSC images on import [#4816](https://github.com/USGS-Astrogeology/ISIS3/issues/4816)

## [6.0.0] - 2021-08-27

Expand Down
55 changes: 8 additions & 47 deletions isis/src/mex/apps/hrsc2isis/hrsc2isis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ find files of those names at the top level of this repository. **/
#include "LineManager.h"
#include "IException.h"
#include "Application.h"
#include "OriginalLabel.h"

using namespace std;
namespace Isis{
void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label);
void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label, UserInterface &ui);
void ImportHrscSrcImage(ProcessImportPds &p, Pvl &label);
void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label, UserInterface &ui, Pvl &originalLab);
void ImportHrscSrcImage(ProcessImportPds &p, Pvl &label, UserInterface &ui);

void IgnoreData(Isis::Buffer &buf);
Expand Down Expand Up @@ -85,47 +84,12 @@ namespace Isis{
ImportHrscSrcImage(p, label, ui);
}
else {
ImportHrscStereoImage(p, label, ui);
ImportHrscStereoImage(p, label, ui, label);
}


}


// Import a PDS3, HRSC, SRC Camera image.
void ImportHrscSrcImage(ProcessImportPds &p, Pvl &label) {

outCube = p.SetOutputCube("TO");
p.StartProcess();

Pvl otherLabels;
TranslateHrscLabels(label, otherLabels);

if (otherLabels.hasGroup("Instrument") &&
(otherLabels.findGroup("Instrument").keywords() > 0)) {
outCube->putGroup(otherLabels.findGroup("Instrument"));
}

if (otherLabels.hasGroup("BandBin") &&
(otherLabels.findGroup("BandBin").keywords() > 0)) {
outCube->putGroup(otherLabels.findGroup("BandBin"));
}

if (otherLabels.hasGroup("Archive") &&
(otherLabels.findGroup("Archive").keywords() > 0)) {
outCube->putGroup(otherLabels.findGroup("Archive"));
}

if (otherLabels.hasGroup("Kernels") &&
(otherLabels.findGroup("Kernels").keywords() > 0)) {
outCube->putGroup(otherLabels.findGroup("Kernels"));
}

p.EndProcess();
}



// Import a PDS3, HRSC, SRC Camera image.
void ImportHrscSrcImage(ProcessImportPds &p, Pvl &label, UserInterface &ui) {
CubeAttributeOutput &att = ui.GetOutputAttribute("TO");
Expand Down Expand Up @@ -178,14 +142,7 @@ namespace Isis{
* NOTE: Regardless of the input file's byte order IMAGE-SAMPLE_TYPE, the prefix data byte order
* is always LSB.
*/

void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label) {
UserInterface &ui = Application::GetUserInterface();
ImportHrscStereoImage(p, label, ui);
}


void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label, UserInterface &ui) {
void ImportHrscStereoImage(ProcessImportPds &p, Pvl &label, UserInterface &ui, Pvl &originalLab) {
lineInFile.clear();
numLinesSkipped = 0;

Expand Down Expand Up @@ -293,6 +250,10 @@ namespace Isis{
outCube->putGroup(otherLabels.findGroup("Kernels"));
}


OriginalLabel ol(originalLab);
outCube->write(ol);

p.EndProcess();

outCube->close();
Expand Down
10 changes: 10 additions & 0 deletions isis/tests/FunctionalTestsHrsc2isis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "PvlGroup.h"
#include "TestUtilities.h"
#include "Histogram.h"
#include "OriginalLabel.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"
Expand Down Expand Up @@ -81,6 +82,11 @@ TEST(Hrsc2isis, Hrsc2IsisTestDefault) {
ASSERT_DOUBLE_EQ(hist->Sum(), 409993);
ASSERT_EQ(hist->ValidPixels(), 6440);
ASSERT_NEAR(hist->StandardDeviation(), 6.36599, .00001);

// check original label exists
Pvl ogLab = cube.readOriginalLabel().ReturnLabels();
ASSERT_EQ(archive["DETECTOR_ID"][0].toStdString(), "MEX_HRSC_RED" );

}


Expand Down Expand Up @@ -134,6 +140,10 @@ TEST(Hrsc2isis, Hrsc2IsisTestPhobos) {
ASSERT_DOUBLE_EQ(hist->Sum(), 2496);
ASSERT_EQ(hist->ValidPixels(), 25920);
ASSERT_NEAR(hist->StandardDeviation(), 0.52835, .00001);

// check original label exists
Pvl ogLab = cube.readOriginalLabel().ReturnLabels();
ASSERT_EQ(archive["DETECTOR_ID"][0].toStdString(), "MEX_HRSC_S2" );
}


Expand Down

0 comments on commit faf913d

Please sign in to comment.