Commit 1121ca40 authored by Stuart Sides's avatar Stuart Sides Committed by Kelvin Rodriguez
Browse files

Avoid edge cases where the histogram only has one bin (#3616)

parent a630a813
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -120,6 +120,12 @@ namespace Isis {
        inMax += p_cubeHist->BinSize();
      }

      // Handles case where the histogram bin size=0
      if (inMin == inMax) {
        inMin -= 1.0;
        inMax += 1.0;
      }

      interpretted.AddPair(inMin, 0);
      interpretted.AddPair(inMax, 255);
    }
+2 −5
Original line number Diff line number Diff line
@@ -106,12 +106,9 @@ namespace Isis {
    double width = 0.0;
    bool changed = false;

    // Too few pairs to do a saw tooth with
    if(newStretch.Pairs() < 3) {
      // Disable all interpretation of linear stretches
      interpretted.CopyPairs(calculateNewStretch());
      offset = p_offsetEdit->text().toDouble();
      width = p_widthEdit->text().toDouble();
      changed = true;
      return;
    }
    else {
      // find an offset... should be the second or third point