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

Add qview stretch bugfix #5492

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ release.

## [Unreleased]

### Fixed
- Fixed a bug in QVIEW's Stretch tool where the default min/max type was not an available option [#5289](https://github.com/DOI-USGS/ISIS3/issues/5289)

## [8.2.0] - 2024-04-18

### Changed
Expand Down
25 changes: 15 additions & 10 deletions isis/src/qisis/objs/StretchTool/StretchTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,22 @@ namespace Isis {
p_minMaxTypeSelection->setToolTip("Min/Max Type");
text =
"<b>Function:</b> Select the minimum & maximum value types to \
set the stretch to. The three options are: \
<p>- Best: (default) The better of the absolute min/max or the \
set the stretch to. The four options are: \
<p>- Default: Min and max values are set to the \
0.5 and 99.5 percentiles, respectively. \
<p>- Best: The better of the absolute min/max or the \
Chebyshev min/max. The better value is considered the value \
closest to the mean. \
<p>- Absolute: The absolute min/max value of all valid pixels. \
<p>- Chebyshev: The min/max value such that a certain percentage \
of data will fall within K standard deviations of the average \
(Chebyshev's Theorem). It can be used to obtain a value that \
does not include statistical outliers. \
<p><b>Hint:</b> Percentages are set to mininum of 0.5 and \
maximum of 99.5.";
does not include statistical outliers.";
p_minMaxTypeSelection->setWhatsThis(text);
p_minMaxTypeSelection->addItem("Best", 0);
p_minMaxTypeSelection->addItem("Absolute", 1);
p_minMaxTypeSelection->addItem("Chebyshev", 2);
p_minMaxTypeSelection->addItem("Default", 0);
p_minMaxTypeSelection->addItem("Best", 1);
p_minMaxTypeSelection->addItem("Absolute", 2);
p_minMaxTypeSelection->addItem("Chebyshev", 3);

connect(p_minMaxTypeSelection, SIGNAL(currentIndexChanged(int)), this, SLOT(changeStretch()));

Expand Down Expand Up @@ -1135,21 +1136,25 @@ namespace Isis {

// Get current band statistics
Statistics stats = statsFromCube(cvp->cube(), bandNum);
Histogram hist = histFromCube(cvp->cube(), bandNum, stats.BestMinimum(), stats.BestMaximum());

// Set min/max given ComboBox selection
int minMaxIndex = p_minMaxTypeSelection->currentIndex();
double selectedMin = 0;
double selectedMax = 0;

if (minMaxIndex == 0) {
selectedMin = hist.Percent(0.5);
selectedMax = hist.Percent(99.5);
} else if (minMaxIndex == 1) {
// Best
selectedMin = stats.BestMinimum();
selectedMax = stats.BestMaximum();
} else if (minMaxIndex == 1) {
} else if (minMaxIndex == 2) {
// Absolute
selectedMin = stats.Minimum();
selectedMax = stats.Maximum();
} else if (minMaxIndex == 2) {
} else if (minMaxIndex == 3) {
// Chebyshev
selectedMin = stats.ChebyshevMinimum();
selectedMax = stats.ChebyshevMaximum();
Expand Down