29 setFixedSize(width, height);
30 setBackgroundRole(QPalette::Dark);
46 m_image =
new QImage(512, 512, QImage::Format_RGB32);
104 if (
chip == NULL || chipCube == NULL) {
106 "Can not view NULL chip pointer",
195 for (
int line = 1; line <
m_chip->
Lines(); line++) {
203 for (
int line = 1; line <=
m_chip->
Lines(); line++) {
206 hist.AddData(&value, 1);
211 if (hist.Percent(0.5) != hist.Percent(99.5)) {
212 stretch.
AddPair(hist.Percent(0.5), 0.0);
213 stretch.
AddPair(hist.Percent(99.5), 255.0);
216 stretch.
AddPair(-DBL_MAX, 0.0);
217 stretch.
AddPair(DBL_MAX, 255.0);
232 QRgb *rgb = (QRgb *)
m_image->scanLine(y);
236 rgb[x] = qRgb(r, g, b);
258 QPainter painter(
this);
264 painter.drawImage(0, 0, *
m_image);
268 painter.setPen(Qt::red);
274 painter.setPen(Qt::red);
281 if (m_controlNet && !serialNumber.isEmpty()
292 for (
int i = 0; i < measures.count(); i++) {
295 double samp = m->GetSample();
296 double line = m->GetLine();
302 if (m->Parent()->IsIgnored() ||
303 (!m->Parent()->IsIgnored() && m->IsIgnored())) {
304 painter.setPen(QColor(255, 255, 0));
308 painter.setPen(Qt::magenta);
311 painter.setPen(Qt::green);
316 painter.drawLine(x - 5, y, x + 5, y);
317 painter.drawLine(x, y - 5, x, y + 5);
493 if (e->key() == Qt::Key_Up) {
496 else if (e->key() == Qt::Key_Down) {
499 else if (e->key() == Qt::Key_Left) {
502 else if (e->key() == Qt::Key_Right) {
506 QWidget::keyPressEvent(e);
513 emit userMovedTackPoint();
528 QPoint p =
event->pos();
529 if (event->button() == Qt::LeftButton) {
533 emit userMovedTackPoint();
623 QString msg =
"Cannot geom chip.\n";
625 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
648 QString msg =
"Cannot load no geom chip.\n";
650 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
676 QString msg =
"Cannot load rotated chip.\n";
678 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
704 "Can not view NULL chip pointer",
718 QString msg =
"Cannot reload chip.\n";
720 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
730 QString msg =
"Cannot reload chip.\n";
732 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
void zoom(double zoomFactor)
Zoom by a specified factor.
void enterEvent(QEvent *e)
If mouse enters, make sure key events are processed w/o clicking.
void SetCubePosition(const double sample, const double line)
Compute the position of the chip given a cube coordinate.
double m_zoomFactor
Zoom Factor.
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
int m_circleSize
Circle size.
void setCircleSize(int size)
Set the size of the circle.
double Map(const double value) const
Maps an input value to an output value based on the stretch pairs and/or special pixel mappings...
A small chip of data used for pattern matching.
BandInfo m_gray
Info for the gray bands.
Cube * m_chipCube
The chip's cube.
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
Stretch stretch
Stretch for the band BandInfo constructor.
bool IsInsideChip(double sample, double line)
void paintImage()
Paints the chip viewport after the chip has been updated.
bool m_stretchLocked
Whether or not to lock the stretch when transforming.
void setCross(bool checked)
Slot to change state of crosshair.
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
Widget to display Isis cubes for qt apps.
This error is for when a programmer made an API call that was illegal.
double tackLine()
Returns tack line.
void computeStretch(Stretch &stretch, bool force=false)
Compute automatic stretch for a portion of the cube.
double tackSample()
Return the position of cube under cross hair.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
void rotateChip(int rotation)
Slot to rotate chip.
void keyPressEvent(QKeyEvent *e)
Process arrow keystrokes on cube.
int GetNumPoints() const
Return the number of control points in the network.
This class is used to accumulate statistics on double arrays.
QImage * m_image
The image.
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
bool m_showPoints
Draw control points.
ChipViewport * m_tempView
Temporary viewport.
virtual ~ChipViewport()
Destructor.
Container of a cube histogram.
#define _FILEINFO_
Macro for the filename and line number.
void refreshView(double tackSample, double tackLine)
Slot to refresh viewport when the tack point has changed.
A type of error that could only have occurred due to a mistake on the user's part (e...
double CubeSample() const
void reloadChip(double tackSample=0., double tackLine=0.)
Reloads the chip at the given tack point on the cube.
QList< QString > GetCubeSerials() const
Use this method to get a complete list of all the cube serial numbers in the network.
void geomChip(Chip *matchChip, Cube *matchChipCube)
Slot to geom chip (apply geometry transformation)
ChipViewport(int width, int height, QWidget *parent=0)
Construct an empty viewport.
void paintEvent(QPaintEvent *e)
Repaint the viewport.
int TackSample() const
This method returns a chip's fixed tack sample; the middle of the chip.
Cube * m_matchChipCube
The matching chip's cube.
double zoomFactor()
Return the zoom factor.
void autoStretch()
Apply automatic stretch using data from entire chip.
bool m_circle
Draw circle.
void Load(Cube &cube, const double rotation=0.0, const double scale=1.0, const int band=1)
Load cube data into the Chip.
void zoom1()
Zoom by a factor of one.
void mousePressEvent(QMouseEvent *event)
Process mouse events.
Stretch * m_stretch
Current stretch on the chip viewport.
void changeStretchLock(int)
Locks or unlocks the stretch on the chip viewport during transformations (zoom, pan, etc.)
QString toString() const
Returns a string representation of this exception.
void ClearPairs()
Clears the stretch pairs.
virtual QString fileName() const
Returns the opened cube's filename.
QList< ControlMeasure *> GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
void setChip(Chip *chip, Cube *chipCube)
Set chip.
void tackPointChanged(double)
< Signal sent when tack point changes
void panRight()
Pan right.
Namespace for ISIS/Bullet specific routines.
double ChipSample() const
double GetValue(int sample, int line)
Loads a Chip with a value.
bool m_cross
Draw crosshair.
void setPoints(bool checked)
Slot to set whether control points are drawn.
void setCircle(bool checked)
Slot to change state of circle.
PointType GetType() const
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Chip * chip() const
Return chip.
void loadView(ChipViewport &newView)
Load with another ChipViewport, used for blinking.
void stretchFromCubeViewport(Stretch *, CubeViewport *)
Applies a new stretch to the specified cube viewport.
void nogeomChip()
Slot to un-geom chip (revert geometry transformation)
bool cubeToViewport(double samp, double line, int &x, int &y)
Get viewport x and y from cube sample and line.
int TackLine() const
This method returns a chip's fixed tack line; the middle of the chip.
Chip * m_matchChip
The matching chip.
IO Handler for Isis Cubes.