Unverified Commit 80339e7d authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Caminfo Logic Fix (#4985)

* Updated CAMSTATS parameter decision tree to allow users to extract camstats even if the cube contains a camstats table

* Updated default test to have a stats table that is ignored
parent 4061694d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ dependencies:
  - krb5
  - libopencv>=4.5.2
  - libpng>=1.6.34
  - libprotobuf
  - libprotobuf<3.20
  - libtiff>=4.0
  - libxml2
  - make
@@ -47,7 +47,7 @@ dependencies:
  - opencv>=4.5.2
  - openssl>=1.1.1k
  - pcl >= 1.10.0
  - protobuf
  - protobuf<3.20
  - python>=3.7.11
  - qhull
  - qt>=5.9.6
+1 −1
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ namespace Isis{
        // Run camstats on the entire image (all bands)
        // another camstats will be run for each band and output
        // for each band.
        else if (ui.GetBoolean("CAMSTATS") && !incube->hasTable("CameraStatistics")) {
        else if (ui.GetBoolean("CAMSTATS")) {
          camstats = new QList< QPair<QString, QString> >;

          QString filename = incube->fileName();
+4 −0
Original line number Diff line number Diff line
@@ -464,6 +464,10 @@ End
      This corrects inconsistencies of footprint generation failing in caminfo
      but passing in footprintinit. Fixes #4651.
    </change>
    <change name="Adam Paquette" date="2021-07-06">
      Updated CAMSTATS parameter decision tree to allow users to extract
      camstats even if the cube contains a camstats table. Fixes #4919.
    </change>
  </history>

  <category>
+32 −0
Original line number Diff line number Diff line
@@ -172,6 +172,38 @@ TEST_F(DefaultCube, FunctionalTestCaminfoCsv) {


TEST_F(DefaultCube, FunctionalTestCaminfoDefault) {
    CameraStatistics camStats(testCube->camera(), 100, 100, testCube->fileName());

    Pvl statsPvl = camStats.toPvl();
    TableField fname("Name", Isis::TableField::Text, 45);
    TableField fmin("Minimum", Isis::TableField::Double);
    TableField fmax("Maximum", Isis::TableField::Double);
    TableField favg("Average", Isis::TableField::Double);
    TableField fstd("StandardDeviation", Isis::TableField::Double);

    TableRecord record;
    record += fname;
    record += fmin;
    record += fmax;
    record += favg;
    record += fstd;

    Table table("CameraStatistics", record);

    for (int i = 1; i < statsPvl.groups(); i++) {
      PvlGroup &group = statsPvl.group(i);

      int entry = 0;
      record[entry] = group.name();
      entry++;
      for (int j = 0; j < group.keywords(); j++) {
        record[entry] = toDouble(group[j][0]);
        entry++;
      }
      table += record;
    }
    testCube->write(table);

    QString outFileName = tempDir.path() + "/outTemp.csv";
    QVector<QString> args = {"to="+outFileName,
        "ISISLABEL=true", "ORIGINAL=true", "STATISTICS=true", "CAMSTATS=true",