USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::ScatterPlotData Class Reference

This is the QwtRasterData for a scatter plot. More...

#include <ScatterPlotData.h>

Inheritance diagram for Isis::ScatterPlotData:
Inheritance graph
Collaboration diagram for Isis::ScatterPlotData:
Collaboration graph

Public Member Functions

 ScatterPlotData (Cube *xCube, int xCubeBand, int xBinCount, Cube *yCube, int yCubeBand, int yBinCount, QwtInterval sampleRange, QwtInterval lineRange)
 ScatterPlotDataConstructor.
 
 ScatterPlotData (const ScatterPlotData &other)
 This is an optimized copy constructor.
 
 ~ScatterPlotData ()
 Destructor.
 
virtual QwtRasterDatacopy () const
 Returns a copy of the ScatterPlotData object.
 
virtual double value (double x, double y) const
 This gets called every time the scatter plot is re-drawn.
 
double xCubeMin () const
 Return the min DN value for the x-axis cube's data range.
 
double xCubeMax () const
 Return the max DN value for the y-axis cube's data range.
 
double yCubeMin () const
 Return the min DN value for the y-axis cube's data range.
 
double yCubeMax () const
 Return the max DN value for the y-axis cube's data range.
 
void swap (ScatterPlotData &other)
 This is part of the copy-and-swap paradigm.
 
QPair< double, double > binXY (int binIndex) const
 Get the center X/Y Dn values for the bin at index.
 
int binCount (int binIndex) const
 Get the count (number of values) which fall into the bin at index.
 
int numberOfBins () const
 Get the total number of bins (bin count in x * bin count in y).
 
QVector< double > discreteXValues () const
 Get a list of all of the x-bin center values for this scatter plot.
 
void alarm (double x, double y)
 Alarm the bin (highlight it) at the given x/y DN value.
 
void clearAlarms ()
 Forget all alarmed bins (viewport->plot).
 
QRectF pixelHint (const QRectF &area) const
 This is a hint given to qwt for how to render a pixel in the spectrogram.
 
ScatterPlotDataoperator= (const ScatterPlotData &other)
 Take the data from other and copy it into this.
 

Private Member Functions

int binCount (int xIndex, int yIndex) const
 Get the count (number of values) which fall into the bin at xIndex, yIndex.
 
int binIndex (int xIndex, int yIndex) const
 Get the single-index position given an x/y index position.
 
int binIndex (double x, double y) const
 Get the single-index position given an x/y dn value.
 
QPair< int, int > binXYIndices (int binIndex) const
 Get the 2D index index position given a 1D (flat) index position.
 
QPair< int, int > binXYIndices (double x, double y) const
 Get the 2D (x/y) index position given an x/y dn value.
 

Private Attributes

QScopedPointer< Stretchm_xDnToBinStretch
 Stretch 1.
 
QScopedPointer< Stretchm_yDnToBinStretch
 Stretch 2.
 
QScopedPointer< QVector
< QVector< int > > > 
m_counts
 The bin counts stored by 2D (x/y) index position.
 
int m_maxCount
 The maximum value in m_counts, stored for efficiency.
 
QScopedPointer< QMap< int, bool > > m_alarmedBins
 map from bin index to alarm state (true for alarmed)
 
double m_xCubeMin
 The minimum DN value for the x cube.
 
double m_xCubeMax
 The maximum DN value for the x cube.
 
double m_yCubeMin
 The minimum DN value for the y cube.
 
double m_yCubeMax
 The maximum DN value for the y cube.
 

Detailed Description

This is the QwtRasterData for a scatter plot.

This gives Qwt values to put in each bin for a spectrogram, effectively making the scatter plot.

Author
????-??-?? Unknown

Definition at line 27 of file ScatterPlotData.h.

Constructor & Destructor Documentation

Isis::ScatterPlotData::ScatterPlotData ( Cube xCube,
int  xCubeBand,
int  xBinCount,
Cube yCube,
int  yCubeBand,
int  yBinCount,
QwtInterval  sampleRange,
QwtInterval  lineRange 
)

ScatterPlotDataConstructor.

Parameters
xCubeThe x-axis cube
xCubeBandThe x-axis cube's band to get DN values from
xBinCountThe resolution of the x-axis
yCubeThe y-axis cube
yCubeBandThe y-axis cube's band to get DN values from
yBinCountThe resolution of the y-axis
sampleRangeThe sample range to gather the histogram from, this is the same for the x cube and y cube.
lineRangeThe line range to gather the histogram from, this is the same for the x cube and y cube.

Definition at line 28 of file ScatterPlotData.cpp.

References Isis::IsSpecial(), Isis::Cube::lineCount(), m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, m_yDnToBinStretch, Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::Cube::pixelType(), Isis::Cube::read(), Isis::Cube::sampleCount(), and value().

Referenced by copy().

Isis::ScatterPlotData::ScatterPlotData ( const ScatterPlotData other)

This is an optimized copy constructor.

Copies are not zero-time, but they are pretty quick.

Parameters
otherThe ScatterPlotData to copy.

Definition at line 114 of file ScatterPlotData.cpp.

References m_alarmedBins, m_counts, m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, and m_yDnToBinStretch.

Isis::ScatterPlotData::~ScatterPlotData ( )

Destructor.

Definition at line 131 of file ScatterPlotData.cpp.

Member Function Documentation

void Isis::ScatterPlotData::alarm ( double  x,
double  y 
)

Alarm the bin (highlight it) at the given x/y DN value.

This is for viewport->plot alarming.

Parameters
xThe x-dn value of the bin to alarm
yThe y-dn value of the bin to alarm

Definition at line 325 of file ScatterPlotData.cpp.

References binIndex().

Referenced by Isis::ScatterPlotWindow::setMousePosition().

int Isis::ScatterPlotData::binCount ( int  binIndex) const

Get the count (number of values) which fall into the bin at index.

Parameters
binIndexThe bin we're getting the data from
Returns
The total number of cube DNs which fall into the given bin

Definition at line 271 of file ScatterPlotData.cpp.

References binXYIndices().

Referenced by Isis::PlotWindowBestFitDialog::refreshWidgetStates(), and value().

int Isis::ScatterPlotData::binCount ( int  xIndex,
int  yIndex 
) const
private

Get the count (number of values) which fall into the bin at xIndex, yIndex.

Parameters
xIndexThe x index of the bin we're getting our data from
yIndexThe y index of the bin we're getting our data from
Returns
The total number of cube DNs which fall into the given bin

Definition at line 383 of file ScatterPlotData.cpp.

References m_counts.

int Isis::ScatterPlotData::binIndex ( int  xIndex,
int  yIndex 
) const
private

Get the single-index position given an x/y index position.

That is, get a 1D (flat) index from a 2D (x/y based) index.

Parameters
xIndexThe x index of the bin we're translating into a 1D index
yIndexThe y index of the bin we're translating into a 1D index
Returns
The 1D (flat) index position

Definition at line 404 of file ScatterPlotData.cpp.

References m_counts.

Referenced by alarm(), binIndex(), binXYIndices(), and value().

int Isis::ScatterPlotData::binIndex ( double  x,
double  y 
) const
private

Get the single-index position given an x/y dn value.

Parameters
xThe x-dn value of the bin
yThe y-dn value of the bin
Returns
The 1D (flat) index position

Definition at line 427 of file ScatterPlotData.cpp.

References binIndex(), and binXYIndices().

QPair< double, double > Isis::ScatterPlotData::binXY ( int  index) const

Get the center X/Y Dn values for the bin at index.

Parameters
indexThe bin to get the center X/Y DN Values for
Returns
The center DN value of the given bin

Definition at line 234 of file ScatterPlotData.cpp.

References _FILEINFO_, binXYIndices(), m_counts, m_xCubeMax, m_xCubeMin, m_yCubeMax, m_yCubeMin, numberOfBins(), and Isis::IException::Programmer.

Referenced by Isis::PlotWindowBestFitDialog::refreshWidgetStates().

QPair< int, int > Isis::ScatterPlotData::binXYIndices ( int  binIndex) const
private

Get the 2D index index position given a 1D (flat) index position.

Parameters
binIndexThe 1D (flat) index of the bin
Returns
The x/y 2D index position

Definition at line 439 of file ScatterPlotData.cpp.

References _FILEINFO_, binIndex(), m_counts, numberOfBins(), and Isis::IException::Programmer.

Referenced by binCount(), binIndex(), binXY(), and value().

QPair< int, int > Isis::ScatterPlotData::binXYIndices ( double  x,
double  y 
) const
private

Get the 2D (x/y) index position given an x/y dn value.

Parameters
xThe x-dn value of the bin
yThe y-dn value of the bin
Returns
The 2D (x/y) bin index position

Definition at line 469 of file ScatterPlotData.cpp.

References Isis::IsSpecial(), m_counts, m_xDnToBinStretch, and m_yDnToBinStretch.

void Isis::ScatterPlotData::clearAlarms ( )

Forget all alarmed bins (viewport->plot).

Definition at line 335 of file ScatterPlotData.cpp.

References m_alarmedBins.

Referenced by Isis::ScatterPlotWindow::setMousePosition().

QwtRasterData * Isis::ScatterPlotData::copy ( ) const
virtual

Returns a copy of the ScatterPlotData object.

Returns
A new instance this this class

Definition at line 140 of file ScatterPlotData.cpp.

References ScatterPlotData().

QVector< double > Isis::ScatterPlotData::discreteXValues ( ) const

Get a list of all of the x-bin center values for this scatter plot.

Returns
A set of discrete x values, useful for things like fitting a line

Definition at line 299 of file ScatterPlotData.cpp.

References m_counts, m_xCubeMax, and m_xCubeMin.

Referenced by Isis::PlotWindowBestFitDialog::createBestFitLine().

int Isis::ScatterPlotData::numberOfBins ( ) const

Get the total number of bins (bin count in x * bin count in y).

Returns
The total number of bins

Definition at line 282 of file ScatterPlotData.cpp.

References m_counts.

Referenced by binXY(), binXYIndices(), and Isis::PlotWindowBestFitDialog::refreshWidgetStates().

ScatterPlotData & Isis::ScatterPlotData::operator= ( const ScatterPlotData other)

Take the data from other and copy it into this.

This uses the copy-and-swap paradigm for exception safety.

Parameters
otherThe scatter plot data which needs copied to this
Returns
This returns *this.

Definition at line 367 of file ScatterPlotData.cpp.

References swap().

QRectF Isis::ScatterPlotData::pixelHint ( const QRectF &  area) const

This is a hint given to qwt for how to render a pixel in the spectrogram.

Parameters
areaThis is ignored
Returns
The size of a pixel in the scatter plot

Definition at line 346 of file ScatterPlotData.cpp.

References m_xCubeMin, m_xDnToBinStretch, m_yCubeMin, and m_yDnToBinStretch.

void Isis::ScatterPlotData::swap ( ScatterPlotData other)

This is part of the copy-and-swap paradigm.

Swap member data with other.

Parameters
otherThe class to trade member data with

Definition at line 214 of file ScatterPlotData.cpp.

References m_alarmedBins, m_counts, m_maxCount, m_xCubeMax, m_xCubeMin, m_xDnToBinStretch, m_yCubeMax, m_yCubeMin, and m_yDnToBinStretch.

Referenced by operator=().

double Isis::ScatterPlotData::value ( double  x,
double  y 
) const
virtual

This gets called every time the scatter plot is re-drawn.

This returns the counts for each DN (x), DN (y), or if the bin is alarmed this returns the max count.

Parameters
xThe X-Dn value
yThe Y-Dn value
Returns
The bin's colorizable-value

Definition at line 154 of file ScatterPlotData.cpp.

References binCount(), binIndex(), binXYIndices(), m_alarmedBins, and m_maxCount.

Referenced by ScatterPlotData().

double Isis::ScatterPlotData::xCubeMax ( ) const

Return the max DN value for the y-axis cube's data range.

Returns
x axis cube data max DN value

Definition at line 184 of file ScatterPlotData.cpp.

References m_xCubeMax.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

double Isis::ScatterPlotData::xCubeMin ( ) const

Return the min DN value for the x-axis cube's data range.

Returns
x axis cube data min DN value

Definition at line 174 of file ScatterPlotData.cpp.

References m_xCubeMin.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

double Isis::ScatterPlotData::yCubeMax ( ) const

Return the max DN value for the y-axis cube's data range.

Returns
x axis cube data max DN value

Definition at line 204 of file ScatterPlotData.cpp.

References m_yCubeMax.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

double Isis::ScatterPlotData::yCubeMin ( ) const

Return the min DN value for the y-axis cube's data range.

Returns
y axis cube data min DN value

Definition at line 194 of file ScatterPlotData.cpp.

References m_yCubeMin.

Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().

Member Data Documentation

QScopedPointer< QMap<int, bool> > Isis::ScatterPlotData::m_alarmedBins
private

map from bin index to alarm state (true for alarmed)

Definition at line 80 of file ScatterPlotData.h.

Referenced by clearAlarms(), ScatterPlotData(), swap(), and value().

QScopedPointer< QVector< QVector<int> > > Isis::ScatterPlotData::m_counts
private

The bin counts stored by 2D (x/y) index position.

The first dimension is the y-index.

Definition at line 72 of file ScatterPlotData.h.

Referenced by binCount(), binIndex(), binXY(), binXYIndices(), discreteXValues(), numberOfBins(), ScatterPlotData(), and swap().

int Isis::ScatterPlotData::m_maxCount
private

The maximum value in m_counts, stored for efficiency.

Definition at line 75 of file ScatterPlotData.h.

Referenced by ScatterPlotData(), swap(), and value().

double Isis::ScatterPlotData::m_xCubeMax
private

The maximum DN value for the x cube.

Definition at line 85 of file ScatterPlotData.h.

Referenced by binXY(), discreteXValues(), ScatterPlotData(), swap(), and xCubeMax().

double Isis::ScatterPlotData::m_xCubeMin
private

The minimum DN value for the x cube.

Definition at line 83 of file ScatterPlotData.h.

Referenced by binXY(), discreteXValues(), pixelHint(), ScatterPlotData(), swap(), and xCubeMin().

QScopedPointer<Stretch> Isis::ScatterPlotData::m_xDnToBinStretch
private

Stretch 1.

Definition at line 65 of file ScatterPlotData.h.

Referenced by binXYIndices(), pixelHint(), ScatterPlotData(), and swap().

double Isis::ScatterPlotData::m_yCubeMax
private

The maximum DN value for the y cube.

Definition at line 89 of file ScatterPlotData.h.

Referenced by binXY(), ScatterPlotData(), swap(), and yCubeMax().

double Isis::ScatterPlotData::m_yCubeMin
private

The minimum DN value for the y cube.

Definition at line 87 of file ScatterPlotData.h.

Referenced by binXY(), pixelHint(), ScatterPlotData(), swap(), and yCubeMin().

QScopedPointer<Stretch> Isis::ScatterPlotData::m_yDnToBinStretch
private

Stretch 2.

Definition at line 66 of file ScatterPlotData.h.

Referenced by binXYIndices(), pixelHint(), ScatterPlotData(), and swap().


The documentation for this class was generated from the following files: