Unverified Commit 7f515561 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

isis2raw pure export update (#4002)

* Changed check and set range logic/removed duplicate code

* Added history comment and moved function outside of if statement

* Fixed pixel type prapogation and boolean logic

* Addressed PR feedback

* Updated the changelog
parent 1bb27b5a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ update the Unreleased link so that it compares against the latest release tag.

## [Unreleased]

### Changed

 - Isis2raw will now output straight to a 32bit file (no stretch) when stretch is set to None and bittype is set to 32bit. [#3878](https://github.com/USGS-Astrogeology/ISIS3/issues/3878)

### Fixed

 - Equalizer now reports the correct equation and values used to perform the adjustment. [#3987](https://github.com/USGS-Astrogeology/ISIS3/issues/3987)
+27 −22
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@
      output image. OMIN and OMAX are now calculated based on the stretch if 32-bit
      is chosen and the OMIN and OMAX fields are left blank. Fixes #2194.
    </change>
    <change name="Adam Paquette" date="2020-09-04">
      Updated application logic to not generate a histogram if stretch is None
      and the output bit type is 32-bit. Also removes duplicate calls to checkRange
      and setRangeAndPixels. Closes #3878 (github).
    </change>
  </history>

  <category>
+13 −10
Original line number Diff line number Diff line
@@ -37,39 +37,42 @@ void IsisMain() {
//    if(ui.GetString("BITTYPE") != "32BIT")
    p.SetInputRange();
  }
  if(ui.GetString("STRETCH") == "MANUAL")
  if(ui.GetString("STRETCH") == "MANUAL") {
    p.SetInputRange(ui.GetDouble("MINIMUM"), ui.GetDouble("MAXIMUM"));
  }

  //  Determine bit size, output range, and calculate number of bytes to write
  //  for each line.
  double min = -DBL_MAX;
  double max = DBL_MAX;
  Pixtype pixType = NONE;
  if(ui.GetString("BITTYPE") == "8BIT") {
    p.SetOutputType(Isis::UnsignedByte);
    min = 0.0;
    max = 255.0;
    checkRange(ui, min, max);
    setRangeAndPixels(ui, p, min, max, BOTH);
    pixType = BOTH;
  }
  else if(ui.GetString("BITTYPE") == "S16BIT") {
    p.SetOutputType(Isis::SignedWord);
    min = -32768.0;
    max = 32767.0;
    checkRange(ui, min, max);
    setRangeAndPixels(ui, p, min, max, NEG);
    pixType = NEG;
  }
  else if(ui.GetString("BITTYPE") == "U16BIT") {
    p.SetOutputType(Isis::UnsignedWord);
    min = 0.0;
    max = 65535.0;
    checkRange(ui, min, max);
    setRangeAndPixels(ui, p, min, max, BOTH);
    pixType = BOTH;
  }
  else if(ui.GetString("BITTYPE") == "32BIT") {
    p.SetOutputType(Isis::Real);
    pixType = NONE;
  }
  
  if (ui.GetString("STRETCH") != "NONE" || ui.GetString("BITTYPE") != "32BIT") {
    checkRange(ui, min, max);
    setRangeAndPixels(ui, p, min, max, NONE);
  }
  setRangeAndPixels(ui, p, min, max, pixType);

  // Set the output endianness
  if(ui.GetString("ENDIAN") == "MSB")