Commit dfe2db14 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Merged dev into Piecewise

parents 36699a0c 68b6bd41
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -7,7 +7,14 @@
# Unignore all dirs
!*/

<<<<<<< HEAD
!Makefile
=======
# Unignore Makefiles, and TestPreferences
!Makefile
!TestPreferences
!*/3rdParty/Makefile
>>>>>>> dev

*.cub
*.o
@@ -18,17 +25,22 @@ moc_*
*.pb.*
*.lbl
*.img
<<<<<<< HEAD

!TestPreferences

print.prt

=======
*.kate-swp
>>>>>>> dev
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
*.moc
ui_*.h

<<<<<<< HEAD
*/3rdParty/*
!*/3rdParty/Makefile

@@ -42,3 +54,17 @@ ui_*.h
*/tsts/*/truth/*
*/tsts/*/output/*

=======
# ignore all files created by squish coco
*csmes

print.prt

*/3rdParty/*
*/inc/*
*/bin/*
*/lib/*
*/tsts/*/input/*
*/tsts/*/truth/*
*/tsts/*/output/*
>>>>>>> dev
+153 −143
Original line number Diff line number Diff line
@@ -470,6 +470,10 @@
    <change name="Jeannie Backer, Tammy Becker, and Kimberly Oyama" date="2014-04-07">
      Updated user documentation. Fixes #1617. Fixes #1620. References #1623. References #1550.
    </change>
    <change name="Cole Neubauer" date="2017-11-20">
      Added parameter checking to XML MAXLON and MAXLAT to check if they are greater than their
      minimum counterpart. Fixes #5148
    </change>
  </history>

  <groups>
@@ -805,6 +809,9 @@
        <description>
          The maximum latitude value boundary extent for the output mosaic.
        </description>
        <greaterThan>
            <item>MINLAT</item>
        </greaterThan>
      </parameter>
      <parameter name="MINLON">
        <type>double</type>
@@ -819,6 +826,9 @@
        <description>
          The maximum longitude value bounary extent for the output mosaic.
        </description>
        <greaterThan>
            <item>MINLON</item>
        </greaterThan>
      </parameter>
    </group>

+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ commands:
	STATISTICS=true CAMSTATS=true GEOMETRY=true spice=true > /dev/null;
	cat $(OUTPUT)/temp.txt | \
	  sed 's/\([0-9]*\.[0-9]\{4\}\)\([0-9]*\)/\1/g' | \
	  sed 's/\([a-z]*\,\)\([0-9]\.[0-9]*\.[0-9]*\.[0-9]* [a-z]* | [0-9]\{4\}\-[0-9]\{2\}\-[0-9]\{2\}\)/\1/g' \
	  sed 's/\([a-z]*\,\)\([0-9]\.[0-9]*\.[0-9]*\.[A-Za-z0-9]* [a-z]* | [0-9]\{4\}\-[0-9]\{2\}\-[0-9]\{2\}\)/\1/g' \
	  > $(OUTPUT)/truth.txt;
	$(RM) $(OUTPUT)/temp.txt;
	$(RM) $(OUTPUT)/input.cub;
+0 −1
Original line number Diff line number Diff line
SIMPLE  =                    T /                                                BITPIX  =                  -32 /                                                NAXIS   =                    2 /                                                NAXIS1  =                   90 /                                                NAXIS2  =                   14 /                                                BZERO   =                  0.0 /                                                BSCALE  =                  1.0 /                                                OBJCTRA =                180.0 /                                                OBJCTDEC=     -36.553241445319 /                                                INSTRUME=             'MOC-WA' /                                                OBSERVER= 'MARS GLOBAL SURVEYOR' /                                              OBJECT  =               'Mars' /                                                DATE-OBS= '1997-10-20T10:58:37.46' /                                            TIME_END= '1997-10-20T11:03:44.66' /                                            END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 No newline at end of file
+166 −73
Original line number Diff line number Diff line
#include "Isis.h"

#include <QString>

#include "Application.h"
#include "Cube.h"
#include "ExportDescription.h"
#include "FileName.h"
#include "Process.h"
#include "ProcessExportPds.h"
#include "ProcessExportPds4.h"
#include "Pvl.h"
#include "PvlKeyword.h"
#include "PvlToXmlTranslationManager.h"

using namespace std;
using namespace Isis;

enum Pixtype { NONE, NEG, BOTH };

void setRangeAndPixels(UserInterface &ui, ProcessExportPds &p,
void setRangeAndPixels(UserInterface &ui, ProcessExport &p,
                       double &min, double &max, Pixtype ptype);
void IsisMain() {
  UserInterface &ui = Application::GetUserInterface();

  // Check if input file is indeed, a cube
  if (ui.GetFileName("FROM").right(3) != "cub") {
    QString msg = "Input file [" + ui.GetFileName("FROM") +
                "] does not appear to be a cube";
    throw  IException(IException::User, msg, _FILEINFO_);
  }

  if (ui.GetString("PDSVERSION") == "PDS3") {
    // Set the processing object
    ProcessExportPds p;

    // Setup the input cube
    p.SetInputCube("FROM");

  UserInterface &ui = Application::GetUserInterface();

    if(ui.GetString("STRETCH") == "LINEAR") {
      if(ui.GetString("BITTYPE") != "32BIT")
        p.SetInputRange();
@@ -93,12 +113,85 @@ void IsisMain() {
    results += PvlKeyword("ValidMin", toString(min));
    results += PvlKeyword("ValidMax", toString(max));
    Application::Log(results);
  }
  else {
    // Setup the process and set the input cube
    ProcessExportPds4 process;
    Cube *icube = process.SetInputCube("FROM");

    PvlObject *label= icube->label();
    if (!label->hasObject("IsisCube")) {
      QString msg = "Input file [" + ui.GetFileName("FROM") +
                  "] does not appear to be an ISIS3 cube.";
      throw  IException(IException::User, msg, _FILEINFO_);
    }
    
    FileName outFile(ui.GetFileName("TO", "img"));
    QString outFileName(outFile.expanded());
    
    if(ui.GetString("STRETCH") == "LINEAR") {
      if(ui.GetString("BITTYPE") != "32BIT")
        process.SetInputRange();
    }
    if(ui.GetString("STRETCH") == "MANUAL")
      process.SetInputRange(ui.GetDouble("MINIMUM"), ui.GetDouble("MAXIMUM"));

    double min = -DBL_MAX;
    double max = DBL_MAX;

    if(ui.GetString("BITTYPE") == "8BIT") {
      process.SetOutputType(Isis::UnsignedByte);
      min = 0.0;
      max = 255.0;
      setRangeAndPixels(ui, process, min, max, BOTH);
    }
    else if(ui.GetString("BITTYPE") == "S16BIT") {
      process.SetOutputType(Isis::SignedWord);
      min = -32768.0;
      max = 32767.0;
      setRangeAndPixels(ui, process, min, max, NEG);
    }
    else if(ui.GetString("BITTYPE") == "U16BIT") {
      process.SetOutputType(Isis::UnsignedWord);
      min = 0.0;
      max = 65535.0;
      setRangeAndPixels(ui, process, min, max, BOTH);
    }
    else {
      process.SetOutputType(Isis::Real);
      process.SetOutputNull(Isis::NULL4);
      process.SetOutputLrs(Isis::LOW_REPR_SAT4);
      process.SetOutputLis(Isis::LOW_INSTR_SAT4);
      process.SetOutputHrs(Isis::HIGH_REPR_SAT4);
      process.SetOutputHis(Isis::HIGH_INSTR_SAT4);
      setRangeAndPixels(ui, process, min, max, NONE);
    }

    if(ui.GetString("ENDIAN") == "MSB")
      process.SetOutputEndian(Isis::Msb);
    else if(ui.GetString("ENDIAN") == "LSB")
      process.SetOutputEndian(Isis::Lsb);

    // Records what it did to the print.prt file
    PvlGroup results("DNs Used");
    results += PvlKeyword("Null", toString(process.OutputNull()));
    results += PvlKeyword("LRS", toString(process.OutputLrs()));
    results += PvlKeyword("LIS", toString(process.OutputLis()));
    results += PvlKeyword("HIS", toString(process.OutputHis()));
    results += PvlKeyword("HRS", toString(process.OutputHrs()));
    results += PvlKeyword("ValidMin", toString(min));
    results += PvlKeyword("ValidMax", toString(max));
    Application::Log(results);

    process.StandardPds4Label();
    process.WritePds4(outFileName);
  }

  return;
}

//Sets up special pixels and valid pixel ranges
void setRangeAndPixels(UserInterface &ui, ProcessExportPds &p, double &min, double &max, Pixtype ptype) {
void setRangeAndPixels(UserInterface &ui, ProcessExport &p, double &min, double &max, Pixtype ptype) {
  if(ptype == NEG) {
    if(ui.GetBoolean("NULL")) {
      p.SetOutputNull(min++);
Loading