Commit a9fcaf2e authored by Adam Paquette's avatar Adam Paquette
Browse files

PROG: Update HistogramTool to analyze the correct pixels when selecting with...

PROG: Update HistogramTool to analyze the correct pixels when selecting with the rectangular bounding box. References #2155.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6909 41f8697f-d340-4b68-9986-7bafba869bb8
parent 04a89537
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@

#include <geos/geom/Point.h>

#include <QDebug>

#include "Brick.h"
#include "CubePlotCurve.h"
#include "Histogram.h"
@@ -286,19 +288,19 @@ namespace Isis {
      else if(rubberBandTool()->currentMode() == RubberBandTool::RectangleMode) {
        double ssamp, sline, esamp, eline;

        // Convert them to line sample values
        // Convert vertices to line sample values
        activeViewport->viewportToCube(vertices[0].x(), vertices[0].y(),
                                       ssamp, sline);

        activeViewport->viewportToCube(vertices[2].x(), vertices[2].y(),
                                       esamp, eline);

        ssamp = ssamp + 0.5;
        sline = sline + 0.5;
        esamp = esamp + 0.5;
        eline = eline + 0.5;
        ssamp = round(ssamp);
        sline = round(sline);
        esamp = round(esamp);
        eline = round(eline);

        int nsamps = (int)(esamp - ssamp + 1);
        if(nsamps < 1) nsamps = -nsamps;
        int nsamps = (int)(std::fabs(esamp - ssamp) + 1);

        Brick *brick = new Brick(*cube, nsamps, 1, 1);

+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ namespace Isis {
  *                          checks the start sample and end sample for the
  *                          plot and starts the plot at the minimum of the 
  *                          2 samples. Fixes #1760.
  *  @history 2016-07-06 Adam Paquette - Fixed the histogram tool to analyze the
  *                          appropriate pixels selected when using box banding
  *                          
  */
  class HistogramTool : public AbstractPlotTool {
      Q_OBJECT