Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

Spectrum2DCanvas Class Reference
[Spectrum visualizaion widgets]

Canvas for 2D-visualization of peak map, feature map and consensus map data. More...

#include <OpenMS/VISUAL/Spectrum2DCanvas.h>

Inheritance diagram for Spectrum2DCanvas:
SpectrumCanvas QWidget DefaultParamHandler

List of all members.

Public Slots

void activateLayer (Size layer_index)
 change the active layer (the one that is used for selecting and so on)
void removeLayer (Size layer_index)
 removes the layer with index layer_index
virtual void updateLayer (Size i)
 Updates layer i when the data in the corresponding file changes.
virtual void horizontalScrollBarChange (int value)
 Notifies the canvas that the horizontal scollbar has been moved.
virtual void verticalScrollBarChange (int value)
 Notifies the canvas that the vertical scollbar has been moved.
void updateProjections ()
 Updates the projection data and emits some related signals.

Signals

void showProjectionHorizontal (ExperimentSharedPtrType, Spectrum1DCanvas::DrawModes)
 Sets the data for the horizontal projection.
void showProjectionVertical (ExperimentSharedPtrType, Spectrum1DCanvas::DrawModes)
 Sets the data for the vertical projection.
void showProjectionInfo (int, double, double)
 Shows the number of peaks and the intensity sum of the projection.
void toggleProjections ()
 Signal emitted when the projections are to be shown/hidden.
void showSpectrumAs1D (int index)
 Requests to display the spectrum with index index in 1D.
void showSpectrumAs1D (std::vector< int, std::allocator< int > > indices)
void showCurrentPeaksAs3D ()
 Requests to display all spectra in 3D plot.

Public Member Functions

 Spectrum2DCanvas (const Param &preferences, QWidget *parent=0)
 Default constructor.
 ~Spectrum2DCanvas ()
 Destructor.
virtual void showCurrentLayerPreferences ()
 Shows the preferences dialog of the active layer.
virtual void saveCurrentLayer (bool visible)
 Saves the current layer data.
void mergeIntoLayer (Size i, FeatureMapSharedPtrType map)
 Merges the features in map into the features layer i.
void mergeIntoLayer (Size i, ConsensusMapSharedPtrType map)
 Merges the consensus features in map into the features layer i.
void mergeIntoLayer (Size i, std::vector< PeptideIdentification > &peptides)
 Merges the peptide identifications in peptides into the peptide layer i.
void recalculateCurrentLayerDotGradient ()
 recalculates the dot gradient of the active layer

Protected Slots

void currentLayerParametersChanged_ ()
 Reacts on changed layer paramters.

Protected Member Functions

bool finishAdding_ ()
 Method that is called when a new layer has been added.
void drawCoordinates_ (QPainter &painter, const PeakIndex &peak)
 Draws the coordinates (or coordinate deltas) to the widget's upper left corner.
void drawDeltas_ (QPainter &painter, const PeakIndex &start, const PeakIndex &end)
 Draws the coordinates (or coordinate deltas) to the widget's upper left corner.
virtual void updateScrollbars_ ()
 Updates the scroll bars.
void paintDots_ (Size layer_index, QPainter &p)
 Paints individual peaks.
void paintAllIntensities_ (Size layer_index, DoubleReal pen_width, QPainter &painter)
void paintMaximumIntensities_ (Size layer_index, Size rt_pixel_count, Size mz_pixel_count, QPainter &p)
 Paints maximum intensity of individual peaks.
void paintPrecursorPeaks_ (Size layer_index, QPainter &painter)
 Paints the precursor peaks.
void paintFeatureData_ (Size layer_index, QPainter &p)
 Paints feature data.
void paintTraceConvexHulls_ (Size layer_index, QPainter &p)
 Paints convex hulls (one for each mass trace) of a features layer.
void paintFeatureConvexHulls_ (Size layer_index, QPainter &p)
 Paints the convex hulls (one for each feature) of a features layer.
void paintIdentifications_ (Size layer_index, QPainter &p)
 Paints peptide identifications (for idXML and unassigned peptides in featureXML).
void paintConsensusElements_ (Size layer_index, QPainter &p)
 Paints the consensus elements of a consensus features layer.
void paintConsensusElement_ (Size layer_index, const ConsensusFeature &cf, QPainter &p, bool use_buffer)
 Paints one consensus element of a consensus features layer.
bool isConsensusFeatureVisible_ (const ConsensusFeature &ce, Size layer_index)
 checks if any element of a consensus feature is currently visible.
void paintConvexHulls_ (const std::vector< ConvexHull2D > &hulls, bool hasIdentifications, QPainter &p)
 Paints convex hulls (one for each mass trace) for a single feature.
virtual void intensityModeChange_ ()
 This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes.
virtual void recalculateSnapFactor_ ()
 REcalculates the intensity scaling factor for 'snap to maximum intensity mode'.
Int precalculatedColorIndex_ (Real val, const MultiGradient &gradient, DoubleReal snap_factor)
 Returns the position on color gradient associated with given intensity .
QColor heightColor_ (Real val, const MultiGradient &gradient, DoubleReal snap_factor)
 Returns the color associated with val for the gradient gradient.
void dataToWidget_ (DoubleReal x, DoubleReal y, QPoint &point)
 Convert chart to widget coordinates.
void recalculateDotGradient_ (Size layer)
 recalculates the dot gradient of a layer
void highlightPeak_ (QPainter &p, const PeakIndex &peak)
 Highlights a single peak and prints coordinates to screen.
PeakIndex findNearestPeak_ (const QPoint &pos)
 Returns the nearest peak to position pos.
void paintIcon_ (const QPoint &pos, const QRgb &color, const String &icon, Size s, QPainter &p) const
 Paints a peak icon for feature and consensus feature peaks.
virtual void translateVisibleArea_ (DoubleReal mzShiftRel, DoubleReal rtShiftRel)
 translates the visible area by a given offset specified in fractions of current visible area
virtual void translateLeft_ ()
 Translation bound to the 'Left' key.
virtual void translateRight_ ()
 Translation bound to the 'Rightt' key.
virtual void translateForward_ ()
 Translation bound to the 'Up' key.
virtual void translateBackward_ ()
 Translation bound to the 'Down' key.
void finishContextMenu_ (QMenu *context_menu, QMenu *settings_menu)
 Finishes context menu after customization to peaks, features or consensus features.
Reimplemented QT events

void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
void mouseMoveEvent (QMouseEvent *e)
void paintEvent (QPaintEvent *e)
void contextMenuEvent (QContextMenuEvent *e)
void keyPressEvent (QKeyEvent *e)
void keyReleaseEvent (QKeyEvent *e)
void mouseDoubleClickEvent (QMouseEvent *e)

Protected Attributes

ExperimentType projection_mz_
 m/z projection data
ExperimentType projection_rt_
 RT projection data.
PeakIndex selected_peak_
 the nearest peak/feature to the mouse cursor
PeakIndex measurement_start_
 start peak/feature of measuring mode

Detailed Description

Canvas for 2D-visualization of peak map, feature map and consensus map data.

This widget displays a 2D representation of a set of peaks, features or consensus elements.

Spectrum2DCanvas.png

The example image shows Spectrum2DCanvas displaying a peak layer and a feature layer.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
default_path string.  Default path for loading/storing data.
background_color string@#ffffff  Background color.
interpolation_steps int1000 min: 1 max: 1000Number of interploation steps for peak gradient precalculation.
mapping_of_mz_to stringy_axis x_axis, y_axisDetermines which axis is the m/z axis.
dot:gradient stringLinear|0,@#eeeeee;1,@#ffea00;6,@#ff0000;14,@#aa00ff;23,@#5500ff;100,@#000000  Multi-color gradient for peaks.
dot:feature_icon stringcircle diamond, square, circle, triangleIcon used for features and consensus features.
dot:feature_icon_size int4 min: 1 max: 999Icon size used for features and consensus features.

Note:
Improvement:
Add RT interpolation mode for high zoom in 2D View (Hiwi)
Improvement:
Snap also to min intensity (Hiwi)

Constructor & Destructor Documentation

Spectrum2DCanvas ( const Param preferences,
QWidget parent = 0 
)

Default constructor.

~Spectrum2DCanvas (  ) 

Destructor.


Member Function Documentation

void activateLayer ( Size  layer_index  )  [virtual, slot]

change the active layer (the one that is used for selecting and so on)

Implements SpectrumCanvas.

void contextMenuEvent ( QContextMenuEvent *  e  )  [protected]
void currentLayerParametersChanged_ (  )  [protected, slot]

Reacts on changed layer paramters.

void dataToWidget_ ( DoubleReal  x,
DoubleReal  y,
QPoint &  point 
) [inline, protected]

Convert chart to widget coordinates.

Translates chart coordinates to widget coordinates.

Parameters:
x the chart coordinate x
y the chart coordinate y
point returned widget coordinates

Reimplemented from SpectrumCanvas.

void drawCoordinates_ ( QPainter &  painter,
const PeakIndex peak 
) [protected]

Draws the coordinates (or coordinate deltas) to the widget's upper left corner.

void drawDeltas_ ( QPainter &  painter,
const PeakIndex start,
const PeakIndex end 
) [protected]

Draws the coordinates (or coordinate deltas) to the widget's upper left corner.

PeakIndex findNearestPeak_ ( const QPoint &  pos  )  [protected]

Returns the nearest peak to position pos.

bool finishAdding_ (  )  [protected, virtual]

Method that is called when a new layer has been added.

Implements SpectrumCanvas.

void finishContextMenu_ ( QMenu *  context_menu,
QMenu *  settings_menu 
) [protected]

Finishes context menu after customization to peaks, features or consensus features.

QColor heightColor_ ( Real  val,
const MultiGradient gradient,
DoubleReal  snap_factor 
) [inline, protected]

Returns the color associated with val for the gradient gradient.

Takes intensity modes into account.

References MultiGradient::precalculatedColorByIndex().

void highlightPeak_ ( QPainter &  p,
const PeakIndex peak 
) [protected]

Highlights a single peak and prints coordinates to screen.

virtual void horizontalScrollBarChange ( int  value  )  [virtual, slot]

Notifies the canvas that the horizontal scollbar has been moved.

Reimplement this slot to react on scrollbar events.

Reimplemented from SpectrumCanvas.

virtual void intensityModeChange_ (  )  [protected, virtual]

This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes.

Reimplemented from SpectrumCanvas.

bool isConsensusFeatureVisible_ ( const ConsensusFeature ce,
Size  layer_index 
) [protected]

checks if any element of a consensus feature is currently visible.

Parameters:
layer_index Index of the layer.
ce The ConsensusFeature that needs checking
void keyPressEvent ( QKeyEvent *  e  )  [protected]

Reimplemented from SpectrumCanvas.

void keyReleaseEvent ( QKeyEvent *  e  )  [protected]

Reimplemented from SpectrumCanvas.

void mergeIntoLayer ( Size  i,
ConsensusMapSharedPtrType  map 
)

Merges the consensus features in map into the features layer i.

void mergeIntoLayer ( Size  i,
std::vector< PeptideIdentification > &  peptides 
)

Merges the peptide identifications in peptides into the peptide layer i.

void mergeIntoLayer ( Size  i,
FeatureMapSharedPtrType  map 
)

Merges the features in map into the features layer i.

Referenced by TOPPViewBase::addData().

void mouseDoubleClickEvent ( QMouseEvent *  e  )  [protected]
void mouseMoveEvent ( QMouseEvent *  e  )  [protected]
void mousePressEvent ( QMouseEvent *  e  )  [protected]
void mouseReleaseEvent ( QMouseEvent *  e  )  [protected]
void paintAllIntensities_ ( Size  layer_index,
DoubleReal  pen_width,
QPainter &  painter 
) [protected]
void paintConsensusElement_ ( Size  layer_index,
const ConsensusFeature cf,
QPainter &  p,
bool  use_buffer 
) [protected]

Paints one consensus element of a consensus features layer.

Parameters:
layer_index Index of the layer.
cf Reference to the feature to be painted.
p The QPainter to paint on.
use_buffer Flag to switch between painting on the buffer and screen.
void paintConsensusElements_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints the consensus elements of a consensus features layer.

Parameters:
layer_index Index of the layer.
p The QPainter to paint on.
void paintConvexHulls_ ( const std::vector< ConvexHull2D > &  hulls,
bool  hasIdentifications,
QPainter &  p 
) [protected]

Paints convex hulls (one for each mass trace) for a single feature.

Parameters:
hulls Reference to convex hull vector.
p The QPainter to paint on.
void paintDots_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints individual peaks.

Calls different painting methods depending on the layer type and the density of displayed peaks

Parameters:
layer_index The index of the layer.
p The QPainter to paint on.
void paintEvent ( QPaintEvent *  e  )  [protected]
void paintFeatureConvexHulls_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints the convex hulls (one for each feature) of a features layer.

Parameters:
layer_index Index of the layer.
p The QPainter to paint on.
void paintFeatureData_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints feature data.

Parameters:
layer_index The index of the layer.
p The QPainter to paint on.
void paintIcon_ ( const QPoint &  pos,
const QRgb &  color,
const String icon,
Size  s,
QPainter &  p 
) const [protected]

Paints a peak icon for feature and consensus feature peaks.

void paintIdentifications_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints peptide identifications (for idXML and unassigned peptides in featureXML).

Parameters:
layer_index Index of the layer.
p The QPainter to paint on.
void paintMaximumIntensities_ ( Size  layer_index,
Size  rt_pixel_count,
Size  mz_pixel_count,
QPainter &  p 
) [protected]

Paints maximum intensity of individual peaks.

Paints the peaks as small ellipses. The peaks are colored according to the selected dot gradient.

Parameters:
layer_index The index of the layer.
p The QPainter to paint on.
void paintPrecursorPeaks_ ( Size  layer_index,
QPainter &  painter 
) [protected]

Paints the precursor peaks.

Parameters:
layer_index The index of the layer.
painter The QPainter to paint on.
void paintTraceConvexHulls_ ( Size  layer_index,
QPainter &  p 
) [protected]

Paints convex hulls (one for each mass trace) of a features layer.

Parameters:
layer_index Index of the layer.
p The QPainter to paint on.
Int precalculatedColorIndex_ ( Real  val,
const MultiGradient gradient,
DoubleReal  snap_factor 
) [inline, protected]

Returns the position on color gradient associated with given intensity .

Takes intensity modes into account.

References MultiGradient::precalculatedColorIndex().

void recalculateCurrentLayerDotGradient (  ) 

recalculates the dot gradient of the active layer

Referenced by TOPPViewBase::setIntensityMode().

void recalculateDotGradient_ ( Size  layer  )  [protected]

recalculates the dot gradient of a layer

virtual void recalculateSnapFactor_ (  )  [protected, virtual]

REcalculates the intensity scaling factor for 'snap to maximum intensity mode'.

See also:
snap_factors_

Reimplemented from SpectrumCanvas.

void removeLayer ( Size  layer_index  )  [virtual, slot]

removes the layer with index layer_index

Implements SpectrumCanvas.

virtual void saveCurrentLayer ( bool  visible  )  [virtual]

Saves the current layer data.

Parameters:
visible If true, only the visible data is stored. Otherwise the whole data is stored.

Implements SpectrumCanvas.

virtual void showCurrentLayerPreferences (  )  [virtual]

Shows the preferences dialog of the active layer.

Implements SpectrumCanvas.

void showCurrentPeaksAs3D (  )  [signal]

Requests to display all spectra in 3D plot.

void showProjectionHorizontal ( ExperimentSharedPtrType  ,
Spectrum1DCanvas::DrawModes   
) [signal]

Sets the data for the horizontal projection.

void showProjectionInfo ( int  ,
double  ,
double   
) [signal]

Shows the number of peaks and the intensity sum of the projection.

void showProjectionVertical ( ExperimentSharedPtrType  ,
Spectrum1DCanvas::DrawModes   
) [signal]

Sets the data for the vertical projection.

void showSpectrumAs1D ( std::vector< int, std::allocator< int > >  indices  )  [signal]
void showSpectrumAs1D ( int  index  )  [signal]

Requests to display the spectrum with index index in 1D.

void toggleProjections (  )  [signal]

Signal emitted when the projections are to be shown/hidden.

virtual void translateBackward_ (  )  [protected, virtual]

Translation bound to the 'Down' key.

Reimplemented from SpectrumCanvas.

virtual void translateForward_ (  )  [protected, virtual]

Translation bound to the 'Up' key.

Reimplemented from SpectrumCanvas.

virtual void translateLeft_ (  )  [protected, virtual]

Translation bound to the 'Left' key.

Reimplemented from SpectrumCanvas.

virtual void translateRight_ (  )  [protected, virtual]

Translation bound to the 'Rightt' key.

Reimplemented from SpectrumCanvas.

virtual void translateVisibleArea_ ( DoubleReal  mzShiftRel,
DoubleReal  rtShiftRel 
) [protected, virtual]

translates the visible area by a given offset specified in fractions of current visible area

virtual void updateLayer ( Size  i  )  [virtual, slot]

Updates layer i when the data in the corresponding file changes.

Implements SpectrumCanvas.

void updateProjections (  )  [slot]
virtual void updateScrollbars_ (  )  [protected, virtual]

Updates the scroll bars.

Updates the scrollbars after a change of the visible area.

Reimplemented from SpectrumCanvas.

virtual void verticalScrollBarChange ( int  value  )  [virtual, slot]

Notifies the canvas that the vertical scollbar has been moved.

Reimplement this slot to react on scrollbar events.

Reimplemented from SpectrumCanvas.


Member Data Documentation

start peak/feature of measuring mode

Reimplemented from SpectrumCanvas.

m/z projection data

RT projection data.

the nearest peak/feature to the mouse cursor

Reimplemented from SpectrumCanvas.


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:58 using doxygen 1.7.1