Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isis2raw pure export update #4002

Merged
merged 6 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 class to checkRange
acpaquette marked this conversation as resolved.
Show resolved Hide resolved
and setRangeAndPixels. Closes #3878 (github).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for later, we need to figure out what we want to do with all of these reference numbers. Maybe in the docs generation, we can put in some logic to switch to pointing to github for changes after a certain date.

</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
22 changes: 12 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,41 @@ 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") {
acpaquette marked this conversation as resolved.
Show resolved Hide resolved
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 +119,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 +138,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