Isis Developer Reference
Isis::StretchTool Class Reference

Stretch image edit tool. More...

#include <StretchTool.h>

Inheritance diagram for Isis::StretchTool:
Inheritance graph
Collaboration diagram for Isis::StretchTool:
Collaboration graph

Public Types

enum  StretchBand {
  Gray , Red , Green , Blue ,
  All
}
 Enum to store the bands. More...
 

Public Slots

void stretchGlobal ()
 Does a global stretch for the active viewport.
 
void stretchGlobal (CubeViewport *)
 Does a global stretch for the specified viewport.
 
void stretchGlobalAllBands ()
 This resets the stretch across all bands.
 
void stretchGlobalAllViewports ()
 Does a global stretch for all the viewports.
 
void stretchRegional ()
 Does a regional stretch for the active viewport.
 
void stretchRegional (CubeViewport *)
 Does a regional stretch for the specified viewport.
 
void activate (bool)
 Activates the tool.
 
void setCubeViewport (MdiCubeViewport *cvp)
 Sets the current viewport to the given cvp.
 

Signals

void stretchChipViewport (Stretch *, CubeViewport *)
 when a viewport is stretched, send the stretch and the viewport associated with it to any ChipViewport's that might be listening
 
void warningSignal (std::string &pStr, const std::string pExStr)
 Shows a warning.
 
void clearWarningSignal ()
 
void toolActivated ()
 
void viewportChanged ()
 

Public Member Functions

 StretchTool (QWidget *parent)
 StretchTool constructor.
 
 ~StretchTool ()
 Destructor.
 
void addTo (QMenu *menu)
 Adds the stretch action to the given menu.
 
void updateAdvStretchDialogforAll (void)
 Update the streches and corresponding histograms for all the colors Red, Green and Blue for Stretch All Mode.
 
QString menuName () const
 This let's Tool know which Menu the actions this class has should be added to.
 
void addTo (ViewportMainWindow *mw)
 Adds the tool to the application.
 
void addTo (ToolPad *toolpad)
 Adds the tool to the toolpad.
 
virtual void addTo (Workspace *ws)
 Adds the given workspace to the cubeviewport list.
 
virtual void addToPermanent (QToolBar *toolbar)
 
void addToActive (QToolBar *toolbar)
 
QString toolIconDir () const
 returns the path to the icon directory.
 
virtual void paintViewport (MdiCubeViewport *vp, QPainter *painter)
 
RubberBandToolrubberBandTool ()
 
void setList (ToolList *currentList)
 

Static Public Member Functions

static Stretch stretchBuffer (ViewportBuffer *buffer, QRect rect)
 This method computes the stretch over a region using the viewport buffer.
 
static Stretch stretchBand (CubeViewport *cvp, StretchBand band)
 This method computes the stretch over the entire cube.
 
static Statistics statsFromCube (Cube *cube, int band)
 This method will calculate and return the statistics for a given cube and band.
 
static Statistics statsFromBuffer (ViewportBuffer *buffer, QRect rect)
 This method will calculate and return the statistics for a given region and viewport buffer.
 
static Histogram histFromCube (Cube *cube, int band, double min, double max)
 This method will calculate and return the histogram for a given cube and band.
 
static Histogram histFromBuffer (ViewportBuffer *buffer)
 Given a viewport buffer, this calculates a histogram.
 
static Histogram histFromBuffer (ViewportBuffer *buffer, QRect rect, double min, double max)
 This method will calculate and return the histogram for a given region and viewport buffer.
 

Protected Types

typedef QVector< MdiCubeViewport * > CubeViewportList
 A list of cubeviewports.
 

Protected Slots

void mouseButtonRelease (QPoint p, Qt::MouseButton s)
 This method will call a global stretch if the right mouse button is released.
 
void saveStretchToCube ()
 Saves a strech to the cube.
 
void deleteFromCube ()
 Deletes a saved stretch from the cube.
 
void loadStretchFromCube ()
 Restores a saved stretch from the cube.
 
void enableRubberBandTool ()
 This method enables the RubberBandTool.
 
void screenPixelsChanged ()
 This is called when the visible area changes.
 
void updateHistograms ()
 This updates the visible histograms in the advanced stretch, if present.
 
void rubberBandComplete ()
 This method is called when the RubberBandTool is complete.
 
void setCubeViewport (CubeViewport *)
 This updates the advanced stretch to use the given viewport.
 
virtual void mouseEnter ()
 
virtual void mouseMove (QPoint p)
 
virtual void mouseMove (QPoint p, Qt::MouseButton)
 
virtual void mouseLeave ()
 

Protected Member Functions

QActiontoolPadAction (ToolPad *pad)
 Adds the stretch action to the toolpad.
 
QWidgetcreateToolBarWidget (QStackedWidget *parent)
 Creates the widget to add to the tool bar.
 
void updateTool ()
 Updates the stretch tool.
 
void stretchRequested (MdiCubeViewport *cvp, int bandId)
 The cube viewport requested a stretch at this time, give it to the viewport.
 
virtual void mouseDoubleClick (QPoint p)
 
virtual void mouseButtonPress (QPoint p, Qt::MouseButton s)
 
virtual void updateMeasure ()
 
virtual void scaleChanged ()
 
void registerTool (MdiCubeViewport *viewport)
 Registers the tool to the viewport.
 
MdiCubeViewportcubeViewport () const
 Return the current cubeviewport.
 
CubeViewportListcubeViewportList () const
 Return the list of cubeviewports.
 
virtual void addConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must add the connections for it.
 
virtual void removeConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must be able to remove it's connections.
 
Workspaceworkspace ()
 

Detailed Description

Stretch image edit tool.

This tool is part of the Qisis namespace and allows interactive editing of displayed images.

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

Member Typedef Documentation

◆ CubeViewportList

typedef QVector< MdiCubeViewport * > Isis::Tool::CubeViewportList
protectedinherited

A list of cubeviewports.

Member Enumeration Documentation

◆ StretchBand

Enum to store the bands.

Enumerator
Gray 

Gray Band.

Red 

Red Band.

Green 

Green Band.

Blue 

Blue Band.

All 

All Bands.

Constructor & Destructor Documentation

◆ StretchTool()

Isis::StretchTool::StretchTool ( QWidget * parent)

◆ ~StretchTool()

Isis::StretchTool::~StretchTool ( )

Destructor.

Member Function Documentation

◆ activate

◆ addConnections()

virtual void Isis::Tool::addConnections ( MdiCubeViewport * cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must add the connections for it.

Parameters
cvp

Reimplemented in Isis::TrackTool, and Isis::WindowTool.

◆ addTo() [1/4]

void Isis::StretchTool::addTo ( QMenu * menu)
virtual

Adds the stretch action to the given menu.

Parameters
menu

Reimplemented from Isis::Tool.

◆ addTo() [2/4]

void Isis::Tool::addTo ( ToolPad * toolpad)
inherited

Adds the tool to the toolpad.

Parameters
toolpad

References Isis::Tool::activate(), and Isis::Tool::toolPadAction().

◆ addTo() [3/4]

◆ addTo() [4/4]

void Isis::Tool::addTo ( Workspace * ws)
virtualinherited

Adds the given workspace to the cubeviewport list.

Parameters
ws

Reimplemented in Isis::EditTool, Isis::FileTool, Isis::SpecialPixelTool, and Isis::WindowTool.

References Isis::Tool::registerTool(), and Isis::Tool::setCubeViewport().

◆ addToActive()

void Isis::Tool::addToActive ( QToolBar * toolbar)
inherited
Parameters
toolbar

References Isis::Tool::createToolBarWidget(), and Isis::ToolList::toolBarStack().

Referenced by Isis::Tool::addTo().

◆ addToPermanent()

virtual void Isis::Tool::addToPermanent ( QToolBar * toolbar)
inlinevirtualinherited

◆ clearWarningSignal

void Isis::Tool::clearWarningSignal ( )
signalinherited

◆ createToolBarWidget()

QWidget * Isis::StretchTool::createToolBarWidget ( QStackedWidget * parent)
protectedvirtual

Creates the widget to add to the tool bar.

Parameters
parent
Returns
QWidget*

Reimplemented from Isis::Tool.

References All, Blue, deleteFromCube(), Green, loadStretchFromCube(), Red, saveStretchToCube(), stretchGlobal(), stretchGlobalAllBands(), stretchGlobalAllViewports(), stretchRegional(), and Isis::Tool::toolIconDir().

◆ cubeViewport()

MdiCubeViewport * Isis::Tool::cubeViewport ( ) const
inlineprotectedinherited

Return the current cubeviewport.

Returns
CubeViewport*

Referenced by Isis::TrackTool::addConnections(), Isis::WindowTool::addConnections(), deleteFromCube(), Isis::FileTool::discard(), Isis::FileTool::exportToList(), Isis::FileTool::exportView(), loadStretchFromCube(), Isis::SunShadowTool::mouseButtonPress(), Isis::EditTool::mouseButtonRelease(), Isis::ControlNetTool::mouseButtonRelease(), Isis::FeatureNomenclatureTool::mouseButtonRelease(), Isis::FindTool::mouseButtonRelease(), Isis::MatchTool::mouseButtonRelease(), Isis::PanTool::mouseButtonRelease(), Isis::QnetTool::mouseButtonRelease(), Isis::RubberBandTool::mouseButtonRelease(), mouseButtonRelease(), Isis::AdvancedTrackTool::mouseLeave(), Isis::SunShadowTool::mouseMove(), Isis::TrackTool::mouseMove(), Isis::RubberBandTool::mouseMove(), Isis::ScatterPlotTool::mouseMove(), Isis::LatLonGridTool::paintViewport(), Isis::FindTool::paintViewport(), Isis::RubberBandTool::paintViewport(), Isis::SunShadowTool::paintViewport(), Isis::FileTool::print(), Isis::HistogramTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::SpectralPlotTool::refreshPlot(), Isis::TrackTool::removeConnections(), Isis::WindowTool::removeConnections(), Isis::EditTool::rubberBandComplete(), Isis::HistogramTool::rubberBandComplete(), Isis::MeasureTool::rubberBandComplete(), Isis::StereoTool::rubberBandComplete(), rubberBandComplete(), Isis::ZoomTool::rubberBandComplete(), Isis::FileTool::save(), Isis::FileTool::saveAs(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveInfo(), saveStretchToCube(), Isis::ScatterPlotTool::showNewScatterPlotConfig(), stretchGlobal(), stretchGlobalAllBands(), stretchRegional(), updateAdvStretchDialogforAll(), updateHistograms(), Isis::MeasureTool::updateMeasure(), Isis::AbstractPlotTool::updateTool(), Isis::BandTool::updateTool(), Isis::BlinkTool::updateTool(), Isis::EditTool::updateTool(), Isis::FileTool::updateTool(), Isis::FindTool::updateTool(), Isis::LatLonGridTool::updateTool(), Isis::SpecialPixelTool::updateTool(), updateTool(), Isis::SunShadowTool::updateTool(), Isis::WindowTool::updateTool(), Isis::ZoomTool::updateTool(), and Isis::AbstractPlotTool::viewportsToPlot().

◆ cubeViewportList()

◆ deleteFromCube

void Isis::StretchTool::deleteFromCube ( )
protectedslot

Deletes a saved stretch from the cube.

References Isis::Tool::cubeViewport().

Referenced by createToolBarWidget(), and StretchTool().

◆ enableRubberBandTool

void Isis::StretchTool::enableRubberBandTool ( )
protectedslot

◆ histFromBuffer() [1/2]

Histogram Isis::StretchTool::histFromBuffer ( ViewportBuffer * buffer)
static

Given a viewport buffer, this calculates a histogram.

Parameters
buffer
Returns
Histogram

References Isis::ViewportBuffer::bufferXYRect(), histFromBuffer(), and statsFromBuffer().

Referenced by histFromBuffer(), setCubeViewport(), stretchBuffer(), updateAdvStretchDialogforAll(), and updateHistograms().

◆ histFromBuffer() [2/2]

Histogram Isis::StretchTool::histFromBuffer ( ViewportBuffer * buffer,
QRect rect,
double min,
double max )
static

This method will calculate and return the histogram for a given region and viewport buffer.

Parameters
buffer
rect
min
max
Returns
Histogram

References _FILEINFO_, Isis::ViewportBuffer::bufferXYRect(), Isis::ViewportBuffer::getLine(), and Isis::IException::Unknown.

◆ histFromCube()

Histogram Isis::StretchTool::histFromCube ( Cube * cube,
int band,
double min,
double max )
static

This method will calculate and return the histogram for a given cube and band.

Parameters
cube
band
min
max
Returns
Histogram

References Isis::Cube::lineCount(), Isis::Cube::pixelType(), Isis::Cube::read(), and Isis::Cube::sampleCount().

Referenced by stretchBand().

◆ loadStretchFromCube

void Isis::StretchTool::loadStretchFromCube ( )
protectedslot

◆ menuName()

QString Isis::StretchTool::menuName ( ) const
inlinevirtual

This let's Tool know which Menu the actions this class has should be added to.

Removal of this results in "Ctrl+R" and "Ctrl+G" not working.

Returns
Name of the Menu

Reimplemented from Isis::Tool.

◆ mouseButtonPress()

void Isis::Tool::mouseButtonPress ( QPoint p,
Qt::MouseButton s )
protectedvirtualinherited
Parameters
p
s

References Isis::Tool::clearWarningSignal().

◆ mouseButtonRelease

void Isis::StretchTool::mouseButtonRelease ( QPoint start,
Qt::MouseButton s )
protectedslot

This method will call a global stretch if the right mouse button is released.

Parameters
start
s

References Isis::Tool::cubeViewport(), enableRubberBandTool(), Isis::Tool::mouseButtonRelease(), stretchChipViewport(), and stretchGlobal().

◆ mouseDoubleClick()

void Isis::Tool::mouseDoubleClick ( QPoint p)
protectedvirtualinherited
Parameters
p

References Isis::Tool::clearWarningSignal().

◆ mouseEnter

virtual void Isis::Tool::mouseEnter ( )
inlineprotectedvirtualslotinherited

◆ mouseLeave

virtual void Isis::Tool::mouseLeave ( )
inlineprotectedvirtualslotinherited

◆ mouseMove [1/2]

void Isis::Tool::mouseMove ( QPoint p)
protectedvirtualslotinherited
Parameters
p

◆ mouseMove [2/2]

virtual void Isis::Tool::mouseMove ( QPoint p,
Qt::MouseButton  )
inlineprotectedvirtualslotinherited

◆ paintViewport()

virtual void Isis::Tool::paintViewport ( MdiCubeViewport * vp,
QPainter * painter )
inlinevirtualinherited

◆ registerTool()

void Isis::Tool::registerTool ( MdiCubeViewport * viewport)
protectedinherited

Registers the tool to the viewport.

Parameters
viewport

References Isis::MdiCubeViewport::registerTool(), and Isis::Tool::stretchRequested().

Referenced by Isis::Tool::addTo().

◆ removeConnections()

virtual void Isis::Tool::removeConnections ( MdiCubeViewport * cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must be able to remove it's connections.

Parameters
cvp

Reimplemented in Isis::MeasureTool, Isis::TrackTool, and Isis::WindowTool.

◆ rubberBandComplete

void Isis::StretchTool::rubberBandComplete ( )
protectedslot

This method is called when the RubberBandTool is complete.

It will get a rectangle from the RubberBandTool and stretch accordingly.

References Isis::Tool::cubeViewport(), Isis::RubberBandTool::rectangle(), and Isis::Tool::rubberBandTool().

◆ rubberBandTool()

◆ saveStretchToCube

◆ scaleChanged()

virtual void Isis::Tool::scaleChanged ( )
inlineprotectedvirtualinherited

Reimplemented in Isis::RubberBandTool.

◆ screenPixelsChanged

void Isis::StretchTool::screenPixelsChanged ( )
protectedslot

This is called when the visible area changes.

References updateHistograms().

Referenced by stretchRequested().

◆ setCubeViewport [1/2]

void Isis::StretchTool::setCubeViewport ( CubeViewport * cvp)
protectedslot

This updates the advanced stretch to use the given viewport.

Parameters
cvp

References Isis::AdvancedStretchDialog::enable(), Isis::AdvancedStretchDialog::enableGrayMode(), Isis::AdvancedStretchDialog::enableRgbMode(), and histFromBuffer().

Referenced by updateTool().

◆ setCubeViewport [2/2]

void Isis::Tool::setCubeViewport ( MdiCubeViewport * cvp)
slotinherited

Sets the current viewport to the given cvp.

Parameters
cvp

References Isis::Tool::updateTool(), and Isis::Tool::viewportChanged().

Referenced by Isis::Tool::addTo(), and Isis::FileTool::closeAll().

◆ setList()

void Isis::Tool::setList ( ToolList * currentList)
inherited

◆ statsFromBuffer()

Statistics Isis::StretchTool::statsFromBuffer ( ViewportBuffer * buffer,
QRect rect )
static

This method will calculate and return the statistics for a given region and viewport buffer.

Parameters
buffer
rect
Returns
Statistics

References _FILEINFO_, Isis::ViewportBuffer::bufferXYRect(), Isis::ViewportBuffer::getLine(), Isis::IException::User, and Isis::ViewportBuffer::working().

Referenced by histFromBuffer(), and stretchBuffer().

◆ statsFromCube()

Statistics Isis::StretchTool::statsFromCube ( Cube * cube,
int band )
static

This method will calculate and return the statistics for a given cube and band.

Parameters
cube
band
Returns
Statistics

References Isis::Cube::lineCount(), Isis::Cube::pixelType(), Isis::Cube::read(), and Isis::Cube::sampleCount().

Referenced by stretchBand().

◆ stretchBand()

Stretch Isis::StretchTool::stretchBand ( CubeViewport * cvp,
StretchBand band )
static

This method computes the stretch over the entire cube.

Parameters
cvp
bandBand to stretch

References Isis::Stretch::AddPair(), Blue, Isis::Stretch::ClearPairs(), Green, histFromCube(), Red, and statsFromCube().

Referenced by Isis::IndependentCubeViewport::restretch(), and stretchRequested().

◆ stretchBuffer()

Stretch Isis::StretchTool::stretchBuffer ( ViewportBuffer * buffer,
QRect rect )
static

This method computes the stretch over a region using the viewport buffer.

Parameters
buffer
rect

References Isis::Stretch::AddPair(), histFromBuffer(), Isis::Stretch::Pairs(), and statsFromBuffer().

Referenced by stretchRequested().

◆ stretchChipViewport

void Isis::StretchTool::stretchChipViewport ( Stretch * ,
CubeViewport *  )
signal

when a viewport is stretched, send the stretch and the viewport associated with it to any ChipViewport's that might be listening

Referenced by mouseButtonRelease().

◆ stretchGlobal [1/2]

void Isis::StretchTool::stretchGlobal ( )
slot

◆ stretchGlobal [2/2]

void Isis::StretchTool::stretchGlobal ( CubeViewport * cvp)
slot

Does a global stretch for the specified viewport.

◆ stretchGlobalAllBands

void Isis::StretchTool::stretchGlobalAllBands ( )
slot

This resets the stretch across all bands.

References Isis::Tool::cubeViewport(), and stretchGlobal().

Referenced by createToolBarWidget().

◆ stretchGlobalAllViewports

void Isis::StretchTool::stretchGlobalAllViewports ( )
slot

Does a global stretch for all the viewports.

References Isis::Tool::cubeViewportList(), and stretchGlobal().

Referenced by createToolBarWidget().

◆ stretchRegional [1/2]

void Isis::StretchTool::stretchRegional ( )
slot

Does a regional stretch for the active viewport.

References Isis::Tool::cubeViewport(), and stretchRegional().

Referenced by createToolBarWidget(), stretchRegional(), and StretchTool().

◆ stretchRegional [2/2]

void Isis::StretchTool::stretchRegional ( CubeViewport * cvp)
slot

Does a regional stretch for the specified viewport.

◆ stretchRequested()

void Isis::StretchTool::stretchRequested ( MdiCubeViewport * cvp,
int bandId )
protectedvirtual

The cube viewport requested a stretch at this time, give it to the viewport.

Parameters
cvp
bandId

Reimplemented from Isis::Tool.

References All, Blue, Isis::Stretch::CopyPairs(), Gray, Green, Red, screenPixelsChanged(), stretchBand(), stretchBuffer(), and updateHistograms().

◆ toolActivated

◆ toolIconDir()

◆ toolPadAction()

QAction * Isis::StretchTool::toolPadAction ( ToolPad * pad)
protectedvirtual

Adds the stretch action to the toolpad.

Parameters
pad
Returns
QAction*

Reimplemented from Isis::Tool.

References Isis::Tool::toolIconDir().

◆ updateAdvStretchDialogforAll()

void Isis::StretchTool::updateAdvStretchDialogforAll ( void )

Update the streches and corresponding histograms for all the colors Red, Green and Blue for Stretch All Mode.

Author
Sharmila Prasad (3/14/2011)

References Isis::Tool::cubeViewport(), histFromBuffer(), and Isis::AdvancedStretchDialog::updateForRGBMode().

◆ updateHistograms

void Isis::StretchTool::updateHistograms ( )
protectedslot

◆ updateMeasure()

virtual void Isis::Tool::updateMeasure ( )
inlineprotectedvirtualinherited

◆ updateTool()

void Isis::StretchTool::updateTool ( )
protectedvirtual

◆ viewportChanged

◆ warningSignal

void Isis::StretchTool::warningSignal ( std::string & pStr,
const std::string pExStr )
signal

Shows a warning.

This sends a signal (meant for when an exception occurs) to display the error using the warning object

Parameters
pStr
pExStr

Referenced by StretchTool().

◆ workspace()


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