Skip to content

Commit

Permalink
corrects for all but 16 bit compression
Browse files Browse the repository at this point in the history
organize template files and add 8bit version

use 8bit template when 8bit

Delete .nfs00000001d83de60d0000003e

remove accidental file

Updated equalizer output (DOI-USGS#4000)

* Fixed equalizer output

* Added changelog

* Added issue number

Stats Docs (DOI-USGS#3923)

* Updated stats documentation

* Updated stats docs based on feedback

isis2raw pure export update (DOI-USGS#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

Add GUI helper to hist so user can see what the minimum and maximum DN values are of the specified band of the cube

Update CHANGELOG.md

update CHANGELOG and rebase to upstream dev

documentation

update CHANGELOG and rebase to upstream dev

documentation
  • Loading branch information
tgiroux committed Sep 8, 2020
1 parent 144ff69 commit 7e140c9
Show file tree
Hide file tree
Showing 15 changed files with 248 additions and 245 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ISIS3 Contributors
- Steven Lambright
- Stuart Sides
- Summer Stapleton
- Timothy Giroux
- Tracie Sucharski
- Travis Addair
- Tyler Wilson
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ 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)
- mro/hideal2pds app now writes the correct SAMPLE_BIT_MASK values to the output label. [#3978](https://github.com/USGS-Astrogeology/ISIS3/issues/3978)

### Added

- A Gui Helper gear was added to hist to fill in the minimum and maximum parameters with what would have been automatically calculated. [#3880](https://github.com/USGS-Astrogeology/ISIS3/issues/3880)

## [4.2.0] - 2020-07-27

### Added
Expand Down
4 changes: 4 additions & 0 deletions isis/src/base/apps/equalizer/equalizer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@
Changed pvl.DIFF of input for app tests nonOverlapRecalculate and nonOverlapRetryBoth to
ignore file names. Allows test to pass when not using default data area. Fixes #4738.
</change>
<change name="Jesse Mapel" date="2020-09-01">
Reported formula and variables now match the formula selected by the ADJUST
argument. Fixes #3987.
</change>
</history>

<groups>
Expand Down
14 changes: 14 additions & 0 deletions isis/src/base/apps/hist/hist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
Re-added the ability to set number of bins without setting min/max values after the last update.
Follow-on to #3881.
</change>
<change name="Stuart Sides" date="2020-09-02">
Added GUI helper for filling in computed min/max. Fixed #3880.
</change>
</history>

<oldName>
Expand Down Expand Up @@ -138,6 +141,17 @@
<description>
Minimum DN value in histogram. If not entered it will automatically be computed.
</description>
<helpers>
<helper name="H1">
<function>helperButtonCalcMinMax</function>
<brief>Fill in the auto calculated MINIMUM and MAXIMUM for the input cube</brief>
<description>
This button will calculate what the default MINIMUM and MAXIMUM values would be
and fills the respective GUI fields with them.
</description>
<icon>$ISISROOT/appdata/images/icons/exec.png</icon>
</helper>
</helpers>
<lessThan>
<item>MAXIMUM</item>
</lessThan>
Expand Down
52 changes: 50 additions & 2 deletions isis/src/base/apps/hist/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define GUIHELPERS
#include "Isis.h"

#include <QDockWidget>
Expand All @@ -18,6 +19,15 @@
using namespace std;
using namespace Isis;

void helperButtonCalcMinMax();

map <QString, void *> GuiHelpers() {
map <QString, void *> helper;
helper ["helperButtonCalcMinMax"] = (void *) helperButtonCalcMinMax;
return helper;
}


void IsisMain() {
Process p;
Cube *icube = p.SetInputCube("FROM");
Expand All @@ -29,7 +39,7 @@ void IsisMain() {
}

Histogram *hist;
if (ui.WasEntered("MINIMUM") && ui.WasEntered("MAXIMUM")){
if (ui.WasEntered("MINIMUM") && ui.WasEntered("MAXIMUM")) {
int nbins = 0;

if (ui.WasEntered("NBINS")){
Expand Down Expand Up @@ -71,7 +81,7 @@ void IsisMain() {
p.Progress()->CheckStatus();
LineManager line(*icube);

for(int i = 1; i <= icube->lineCount(); i++) {
for (int i = 1; i <= icube->lineCount(); i++) {
line.SetLine(i);
icube->read(line);
hist->AddData(line.DoubleBuffer(), line.size());
Expand Down Expand Up @@ -236,3 +246,41 @@ void IsisMain() {
delete hist;
p.EndProcess();
}


// Helper function to fill in the auto calculated min/max.
void helperButtonCalcMinMax() {

UserInterface &ui = Application::GetUserInterface();

// Setup a cube for gathering stats from the user requested band
QString file = ui.GetFileName("FROM");

Cube inCube;
CubeAttributeInput attrib = ui.GetInputAttribute("FROM");
if (attrib.bands().size() != 0) {
vector<QString> bands = attrib.bands();
inCube.setVirtualBands(bands);
}

inCube.open(file, "r");

LineManager line(inCube);
Statistics cubeStats;

for (int i = 1; i <= inCube.lineCount(); i++) {
line.SetLine(i);
inCube.read(line);
cubeStats.AddData(line.DoubleBuffer(), line.size());
}

inCube.close();

// Write ranges to the GUI
ui.Clear("MINIMUM");
ui.PutDouble("MINIMUM", cubeStats.Minimum());
ui.Clear("MAXIMUM");
ui.PutDouble("MAXIMUM", cubeStats.Maximum());

}

49 changes: 27 additions & 22 deletions isis/src/base/apps/isis2raw/isis2raw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
The raw image may be output into an 8-bit, 16-bit unsigned, 16-bit signed
or 32-bit raw image. This raw image can be in BSQ, BIL, or BIP format, and
can include or exclude Null, LRS, LIS, HIS, and/or HRS specific DN values.
If no special pixel parameters are selected, then Low Saturation values and
If no special pixel parameters are selected, then Low Saturation values and
Null values are set to black and High Saturation values are set to white.
To ensure acceptable contrast in the output file, the user may select from
To ensure acceptable contrast in the output file, the user may select from
three stretch options are given 1) no stretch 2) linear, and 3) manual.
A custom maximum and minimum DN value can be specified for all output
bittypes. For example, if a range of 0 to 1023 is selected in a 16-bit
A custom maximum and minimum DN value can be specified for all output
bittypes. For example, if a range of 0 to 1023 is selected in a 16-bit
unsigned raw image, the DNs are stretched to an effective 10-bit format.
</description>

Expand Down Expand Up @@ -57,7 +57,7 @@
Fixed problem where the valid data range overlapped the null value.
</change>
<change name="Christopher Austin" date ="2007-12-17">
Created options to ouput BIL and BIP formats, making BSQ the default, as
Created options to ouput BIL and BIP formats, making BSQ the default, as
well as added preserve special pixel (NULL) option.
</change>
<change name="Christopher Austin" date="2008-06-10">
Expand All @@ -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>
Expand Down Expand Up @@ -173,15 +178,15 @@
The minimum output DN value including special pixels.
</brief>
<description>
If a value is provided, the value will be the minimum DN used (including special
pixels). If left blank and the BITTYPE is not 32BIT, the minimum DN value
will default to the smallest value possible for the provided
If a value is provided, the value will be the minimum DN used (including special
pixels). If left blank and the BITTYPE is not 32BIT, the minimum DN value
will default to the smallest value possible for the provided
BITTYPE. If the BITTYPE is 32BIT and OMIN is left blank, the value
of OMIN will depend on the STRETCH type chosen. If LINEAR is
chosen, the value for OMIN will be the DN value at the value
entered for MINPERCENT on the data. If MANUAL is chosen, the OMIN
will equal to the value of MINIMUM. If NONE is chosen, the value
will default to the smallest value possible for 32 bit data.
of OMIN will depend on the STRETCH type chosen. If LINEAR is
chosen, the value for OMIN will be the DN value at the value
entered for MINPERCENT on the data. If MANUAL is chosen, the OMIN
will equal to the value of MINIMUM. If NONE is chosen, the value
will default to the smallest value possible for 32 bit data.
</description>
<internalDefault>
Refer to Documentation
Expand All @@ -193,14 +198,14 @@
The maximum output DN value including special pixels.
</brief>
<description>
If a value is provided, the value will be the maximum DN used (including special
pixels). If left blank and the BITTYPE is not 32BIT, the maximum DN value
will default to the largest value possible for the provided
If a value is provided, the value will be the maximum DN used (including special
pixels). If left blank and the BITTYPE is not 32BIT, the maximum DN value
will default to the largest value possible for the provided
BITTYPE. If the BITTYPE is 32BIT and OMAX is left blank, the value
of OMAX will depend on the STRETCH type chosen. If LINEAR is
chosen, the value for OMAX will be the DN value at the value
entered for MAXPERCENT on the data. If MANUAL is chosen, the OMIN
will equal to the value of MAXIMUM. If NONE is chosen, the value
of OMAX will depend on the STRETCH type chosen. If LINEAR is
chosen, the value for OMAX will be the DN value at the value
entered for MAXPERCENT on the data. If MANUAL is chosen, the OMIN
will equal to the value of MAXIMUM. If NONE is chosen, the value
will default to the largest value possible for 32 bit data.
</description>
<internalDefault>
Expand All @@ -212,7 +217,7 @@
<default><item>true</item></default>
<brief>Dedicates the minimum DN value for null pixels.</brief>
<description>
If set to true, the minimum value of the raw output data will be
If set to true, the minimum value of the raw output data will be
reserved for null pixels. The actual value used for null pixels will
be denoted in the print.prt file and displayed onscreen.
</description>
Expand Down Expand Up @@ -403,7 +408,7 @@
</default>
<brief>Storage order of output file.</brief>
<description>
Sets the storage order of the raw ouput file to BSQ, BIL, or
Sets the storage order of the raw ouput file to BSQ, BIL, or
BIP.
</description>
<list>
Expand Down
23 changes: 13 additions & 10 deletions isis/src/base/apps/isis2raw/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -117,7 +120,7 @@ void IsisMain() {
// Validates provided range
void checkRange(UserInterface &ui, double &min, double &max) {
Isis::Histogram *hist = p_cube->histogram(0);

if(ui.WasEntered("OMIN")) {
if(ui.GetDouble("OMIN") < min) {
QString message = "OMIN [" + toString(min) + "] is too small for the provided BITTYPE [";
Expand All @@ -136,7 +139,7 @@ void checkRange(UserInterface &ui, double &min, double &max) {
min = ui.GetDouble("MINIMUM");
}
}

if(ui.WasEntered("OMAX")) {
if(ui.GetDouble("OMAX") > max) {
QString message = "OMAX [" + toString(max) + "] is too large for the provided BITTYPE [";
Expand Down
Loading

0 comments on commit 7e140c9

Please sign in to comment.