diff --git a/CHANGELOG.md b/CHANGELOG.md index 49badccdf034848fc7d457bb813e84589064cfa7..d6cc7a4fb6ff5fd7798addcf1fbfce902614dfc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/isis/src/qisis/objs/StretchTool/StretchTool.cpp b/isis/src/qisis/objs/StretchTool/StretchTool.cpp index 3ee41848c3409f3551eac7d900d77ab46ba4f221..b747cdd8789489a110120ef6f97d447fb4aaa92a 100644 --- a/isis/src/qisis/objs/StretchTool/StretchTool.cpp +++ b/isis/src/qisis/objs/StretchTool/StretchTool.cpp @@ -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())); @@ -1135,6 +1136,7 @@ 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(); @@ -1142,14 +1144,17 @@ namespace Isis { 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();