Commit babbf69a authored by acpaquette's avatar acpaquette Committed by Stuart Sides
Browse files

gllssi2isis Original Label Fix (#3226)

* Allowed writting of residuals when value is zero to controlnet pvl

* Updated ControlNetVersioner unit test

* Fixed pvl labels original pvl labels not being written to the resulting cube.

* Updated docstrings and history for updated methods

* Removed the need to set the output cube pixel type

* Reverted proceeimport changes

* Set the dimensions in the process before processing

* Added missing 1 in a history record

* Reverted and applied a more appropriate fix

* Used outfile obtained at the beginning of the program

* Added history comment to app xml
parent 8a24f8fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ namespace Isis {
   *                           was made to accomodate Rosetta VIRTIS-m calibrated data files and
   *                           has no impact on other supported BIP files.
   *                           Fixes #5398.
   *   @history 208-07-19 Tyler Wilson - Added support for 4-byte UnsignedInteger special pixel
   *   @history 2018-07-19 Tyler Wilson - Added support for 4-byte UnsignedInteger special pixel
   *                            values.
   *
   */
+27 −23
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@
      Changed documentation to have the correct link to the Planetary Science Data
      Dictionary Document.  Fixes #3867
    </change>
    <change name="Adam Paquette", date="2019-04-16">
      Fixed original label not being written to cubes ingested using the summed
      option. Fixes #3207
    </change>


  </history>
+17 −37
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include "IException.h"
#include "iTime.h"
#include "ProcessImportPds.h"
#include "OriginalLabel.h"
#include "UserInterface.h"

#include <cstdio>
@@ -14,9 +15,6 @@
#include <QFile>





using namespace std;
using namespace Isis;
bool summed;
@@ -28,7 +26,6 @@ void translateLabels(Pvl &pdsLabel, Cube *ocube);
void fixPvl(QString fileName);

void IsisMain() {

  //initialize globals
  summed = false;
  summedOutput = NULL;
@@ -36,17 +33,12 @@ void IsisMain() {
  ProcessImportPds p;
  UserInterface &ui = Application::GetUserInterface();
  FileName inFile = ui.GetFileName("FROM");
  FileName out = ui.GetFileName("TO");


  FileName outFile = ui.GetFileName("TO");

  // Apply a fix to the gallileo pds labels so they can be read
  fixPvl(inFile.toString());




  // Make sure it is a Galileo SSI image

  Pvl lab(inFile.expanded());

  //Checks if in file is rdr
@@ -102,35 +94,34 @@ void IsisMain() {
  Pvl pdsLabel;
  p.SetPdsFile(inFile.expanded(), "", pdsLabel);

  //Set up the output file
  Cube *ocube;

  // If summed handle the image similarly to pds2isis
  // with an extra translation step
  if (!summed) {
    ocube = p.SetOutputCube("TO");
    Cube *ocube = p.SetOutputCube("TO");
    p.StartProcess();
    translateLabels(pdsLabel, ocube);
    p.EndProcess();
  }
  else {
  // Otherwise the dimensions of the cube need to be cut in half before
  // processsing. Since we didn't set the output cube we need to take care
  // of writting the original label ourselves
    summedOutput = new Cube();
    summedOutput->setDimensions(p.Samples() / 2, p.Lines() / 2, p.Bands());
    summedOutput->setPixelType(p.PixelType());
    summedOutput->create(ui.GetFileName("TO"));
    p.StartProcess(translateData);
    ocube = summedOutput;
  }
    summedOutput->create(outFile.expanded());

  translateLabels(pdsLabel, ocube);
  p.EndProcess();
    p.StartProcess(translateData);
    translateLabels(pdsLabel, summedOutput);

  if (summed) {
    OriginalLabel ol(Pvl(inFile.expanded()));
    summedOutput->write(ol);
    summedOutput->close();
    delete summedOutput;
  }

  return;
}



/**
  * This fixes a problem with some of the Pvl files where a comment
  * was left open.  If the file has this error, the comment is closed
@@ -141,9 +132,6 @@ void IsisMain() {
  *     being checked
  *
  */



void fixPvl(QString fileName){

    QFile pvlFile;
@@ -174,15 +162,7 @@ void fixPvl(QString fileName){

}









void translateData(Buffer &inData) {
void translateData(Isis::Buffer &inData) {
  summedOutput->write(inData);
}