diff --git a/CHANGELOG.md b/CHANGELOG.md
index bbc9a7a6b8..671070e835 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
diff --git a/isis/src/base/apps/isis2raw/isis2raw.xml b/isis/src/base/apps/isis2raw/isis2raw.xml
index 0447771915..ab8d54a9f4 100644
--- a/isis/src/base/apps/isis2raw/isis2raw.xml
+++ b/isis/src/base/apps/isis2raw/isis2raw.xml
@@ -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.
@@ -57,7 +57,7 @@
Fixed problem where the valid data range overlapped the null value.
- 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.
@@ -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.
+
+ 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).
+
@@ -173,15 +178,15 @@
The minimum output DN value including special pixels.
- 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.
Refer to Documentation
@@ -193,14 +198,14 @@
The maximum output DN value including special pixels.
- 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.
@@ -212,7 +217,7 @@
- true
Dedicates the minimum DN value for null pixels.
- 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.
@@ -403,7 +408,7 @@
Storage order of output file.
- 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.
diff --git a/isis/src/base/apps/isis2raw/main.cpp b/isis/src/base/apps/isis2raw/main.cpp
index 0af54a711a..74cbed6491 100644
--- a/isis/src/base/apps/isis2raw/main.cpp
+++ b/isis/src/base/apps/isis2raw/main.cpp
@@ -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")
@@ -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 [";
@@ -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 [";