35 #ifndef OPENMS_VISUAL_SPECTRUMCANVAS_H 36 #define OPENMS_VISUAL_SPECTRUMCANVAS_H 39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h> 49 #include <QtGui/QWidget> 50 #include <QtGui/QRubberBand> 168 spectrum_widget_ = widget;
179 return spectrum_widget_;
202 return intensity_mode_;
216 intensity_mode_ = mod;
217 intensityModeChange_();
233 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer(index) index overflow");
234 return layers_[index];
240 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
241 return layers_[current_layer_];
247 return current_layer_;
253 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
254 return layers_[current_layer_];
260 return getLayerFlag(current_layer_, f);
266 setLayerFlag(current_layer_, f, value);
272 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::getLayerFlag() index overflow");
273 return layers_[layer].flags.test(f);
280 if (layers_.empty())
return;
282 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::setLayerFlag() index overflow");
284 layers_[layer].flags.set(f, value);
285 update_buffer_ =
true;
292 if (layers_.empty())
return;
294 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::setLabel() index overflow");
295 layers_[current_layer_].label = label;
297 update_buffer_ =
true;
308 return visible_area_;
314 virtual void setFilters(
const DataFilters & filters);
319 return mz_to_x_axis_;
323 void mzToXAxis(
bool mz_to_x_axis);
331 inline Size getLayerCount()
const 334 return layers_.size();
338 Size activeLayerIndex()
const;
340 virtual void activateLayer(
Size layer_index) = 0;
342 virtual void removeLayer(
Size layer_index) = 0;
353 bool addLayer(ExperimentSharedPtrType map,
const String & filename =
"");
363 bool addLayer(FeatureMapSharedPtrType map,
const String & filename =
"");
373 bool addLayer(ConsensusMapSharedPtrType map,
const String & filename =
"");
384 bool addLayer(std::vector<PeptideIdentification> & peptides,
385 const String & filename =
"");
392 return getCurrentLayer().getPeakData()->getMinInt();
396 return getCurrentLayer().getFeatureMap()->getMinInt();
400 return getCurrentLayer().getConsensusMap()->getMinInt();
409 return getCurrentLayer().getPeakData()->getMaxInt();
413 return getCurrentLayer().getFeatureMap()->getMaxInt();
417 return getCurrentLayer().getConsensusMap()->getMaxInt();
426 return getLayer(index).getPeakData()->getMinInt();
430 return getLayer(index).getFeatureMap()->getMinInt();
434 return getLayer(index).getConsensusMap()->getMinInt();
443 return getLayer(index).getPeakData()->getMaxInt();
447 return getLayer(index).getFeatureMap()->getMaxInt();
451 return getLayer(index).getConsensusMap()->getMaxInt();
456 void setLayerName(
Size i,
const String & name);
464 getCurrentLayer_().param = param;
465 emit preferencesChange();
480 double getSnapFactor();
483 double getPercentageFactor();
486 virtual void showCurrentLayerPreferences() = 0;
494 virtual void showMetaData(
bool modifiable =
false,
Int index = -1);
501 virtual void saveCurrentLayer(
bool visible) = 0;
511 void changeVisibility(
Size i,
bool b);
519 void changeLayerFilterState(
Size i,
bool b);
527 void showGridLines(
bool show);
536 void resetZoom(
bool repaint =
true);
544 void setVisibleArea(AreaType area);
551 virtual void horizontalScrollBarChange(
int value);
558 virtual void verticalScrollBarChange(
int value);
561 void setAdditionalContextMenu(QMenu * menu);
570 void getVisiblePeakData(ExperimentType & map)
const;
580 void getVisibleFeatureData(FeatureMapType & map)
const;
589 void getVisibleConsensusData(ConsensusMapType & map)
const;
598 void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides)
const;
601 virtual void updateLayer(
Size i) = 0;
606 void layerModficationChange(
Size layer,
bool modified);
609 void layerActivated(
QWidget * w);
612 void layerZoomChanged(
QWidget * w);
623 void sendCursorStatus(
double mz = -1.0,
double rt = -1.0);
626 void sendStatusMessage(std::string message,
OpenMS::UInt time);
629 void recalculateAxes();
632 void updateVScrollbar(
float,
float,
float,
float);
635 void updateHScrollbar(
float,
float,
float,
float);
638 void changeLegendVisibility();
641 void actionModeChange();
644 void preferencesChange();
649 void updateCursor_();
654 void drawText_(QPainter & painter, QStringList text);
657 double getIdentificationMZ_(
const Size layer_index,
661 virtual bool finishAdding_() = 0;
666 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer_(index) index overflow");
667 return layers_[index];
673 return getLayer_(current_layer_);
679 return getCurrentLayer_().getPeakData();
684 void resizeEvent(QResizeEvent * e);
685 void wheelEvent(QWheelEvent * e);
686 void keyPressEvent(QKeyEvent * e);
687 void keyReleaseEvent(QKeyEvent * e);
688 void focusOutEvent(QFocusEvent * e);
689 void leaveEvent(QEvent * e);
690 void enterEvent(QEvent * e);
694 virtual void intensityModeChange_();
706 virtual void changeVisibleArea_(
const AreaType & new_area,
bool repaint =
true,
bool add_to_stack =
false);
713 virtual void recalculateSnapFactor_();
717 virtual void zoom_(
int x,
int y,
bool zoom_in);
722 virtual void zoomForward_();
724 void zoomAdd_(
const AreaType & area);
731 virtual void translateLeft_(Qt::KeyboardModifiers m);
734 virtual void translateRight_(Qt::KeyboardModifiers m);
736 virtual void translateForward_();
738 virtual void translateBackward_();
746 virtual void updateScrollbars_();
762 visible_area_.minX() + (height() - y) / height() * visible_area_.width(),
763 visible_area_.minY() + x / width() * visible_area_.height()
769 visible_area_.minX() + x / width() * visible_area_.width(),
770 visible_area_.minY() + (height() - y) / height() * visible_area_.height()
778 return widgetToData_(pos.x(), pos.y());
797 point.setX(
int((y - visible_area_.minY()) / visible_area_.height() * width()));
802 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
806 point.setY(height() -
int((x - visible_area_.minX()) / visible_area_.width() * height()));
810 point.setX(
int((x - visible_area_.minX()) / visible_area_.width() * width()));
814 point.setY(height() -
int((y - visible_area_.minY()) / visible_area_.height() * height()));
818 point.setY(height() -
int(
819 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
826 virtual void paintGridLines_(QPainter & painter);
860 void recalculateRanges_(
UInt mz_dim,
UInt rt_dim,
UInt it_dim);
888 virtual void update_(
const char * caller_name);
891 void modificationStatus_(
Size layer_index,
bool modified);
900 void adjustBuffer_();
939 std::set<DataProcessing::ProcessingAction> actions;
940 actions.insert(action);
944 p->setProcessingActions(actions);
946 p->getSoftware().setName(
"SpectrumCanvas");
952 for (
Size i = 0; i < map.
size(); ++i)
954 map[i].getDataProcessing().push_back(p);
float getCurrentMaxIntensity() const
Returns the maximum intensity of the active layer.
Definition: SpectrumCanvas.h:405
Flags
Flags that determine which information is shown.
Definition: LayerData.h:79
Description of the applied preprocessing steps.
Definition: DataProcessing.h:52
bool show_grid_
Stores whether or not to show a grid.
Definition: SpectrumCanvas.h:872
bool update_buffer_
Whether to recalculate the data in the buffer when repainting.
Definition: SpectrumCanvas.h:894
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition: SpectrumCanvas.h:109
float getMaxIntensity(Size index) const
Returns the maximum intensity of the layer with index index.
Definition: SpectrumCanvas.h:439
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: SpectrumCanvas.h:111
float getMinIntensity(Size index) const
Returns the minimum intensity of the layer with index index.
Definition: SpectrumCanvas.h:422
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:112
std::vector< AreaType >::iterator zoom_pos_
The current position in the zoom stack.
Definition: SpectrumCanvas.h:877
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks)
Definition: SpectrumCanvas.h:122
A more convenient string class.
Definition: String.h:57
std::vector< double > snap_factors_
Intensity scaling factor for 'snap to maximum intensity mode'.
Definition: SpectrumCanvas.h:920
DPosition< 2 > PointType
Type of the Points.
Definition: SpectrumCanvas.h:129
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
Definition: SpectrumCanvas.h:146
const AreaType & getVisibleArea() const
Returns the currently visible area.
Definition: SpectrumCanvas.h:306
bool show_timing_
Flag that determines if timing data is printed to the command line.
Definition: SpectrumCanvas.h:929
std::vector< LayerData > layers_
Layer data.
Definition: SpectrumCanvas.h:838
SpectrumWidget * getSpectrumWidget() const
Returns the spectrum widget.
Definition: SpectrumCanvas.h:177
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos.
Definition: SpectrumCanvas.h:776
LayerData & getLayer_(Size index)
Returns the layer with index index.
Definition: SpectrumCanvas.h:664
LayerData::ConsensusMapType ConsensusMapType
Main data type (consensus features)
Definition: SpectrumCanvas.h:115
QImage buffer_
Buffer that stores the actual peak information.
Definition: SpectrumCanvas.h:829
bool getLayerFlag(Size layer, LayerData::Flags f) const
returns a layer flag of the layer layer
Definition: SpectrumCanvas.h:270
A container for features.
Definition: FeatureMap.h:94
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:107
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
DRange< 3 > overall_data_range_
Stores the data range (m/z, RT and intensity) of all layers.
Definition: SpectrumCanvas.h:869
ActionModes
Mouse action modes.
Definition: SpectrumCanvas.h:135
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features)
Definition: SpectrumCanvas.h:117
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:104
bool mz_to_x_axis_
Stores the mapping of m/z.
Definition: SpectrumCanvas.h:841
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
A container for consensus elements.
Definition: ConsensusMap.h:72
void addDataProcessing_(PeakMap &map, DataProcessing::ProcessingAction action) const
Data processing setter for peak maps.
Definition: SpectrumCanvas.h:937
void setLabel(LayerData::LabelType label)
Definition: SpectrumCanvas.h:289
zoom
Definition: SpectrumCanvas.h:138
bool gridLinesShown() const
Returns if the grid is currently shown.
Definition: SpectrumCanvas.h:225
Size size() const
Definition: MSExperiment.h:132
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
SpectrumType::PeakType PeakType
Peak type.
Definition: SpectrumCanvas.h:124
void setSpectrumWidget(SpectrumWidget *widget)
Sets the spectrum widget.
Definition: SpectrumCanvas.h:166
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:124
Chromatogram data.
Definition: LayerData.h:73
PeakIndex selected_peak_
selected peak
Definition: SpectrumCanvas.h:932
void setLayerFlag(LayerData::Flags f, bool value)
sets a layer flag of the current layer
Definition: SpectrumCanvas.h:264
Shows the maximum displayed intensity as if it was the overall maximum intensity. ...
Definition: SpectrumCanvas.h:147
Size current_layer_
Stores the index of the currently active layer.
Definition: SpectrumCanvas.h:897
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
ExperimentSharedPtrType currentPeakData_()
Returns the currently active layer (mutable)
Definition: SpectrumCanvas.h:677
LayerData & getCurrentLayer_()
Returns the currently active layer.
Definition: SpectrumCanvas.h:671
PeakIndex measurement_start_
start peak of measuring mode
Definition: SpectrumCanvas.h:934
Feature data.
Definition: LayerData.h:71
PointType widgetToData_(double x, double y)
Convert widget to chart coordinates.
Definition: SpectrumCanvas.h:757
void setIntensityMode(IntensityModes mod)
Sets the intensity mode.
Definition: SpectrumCanvas.h:214
ProcessingAction
Definition: DataProcessing.h:59
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:127
SpectrumWidget * spectrum_widget_
Back-pointer to the enclosing spectrum widget.
Definition: SpectrumCanvas.h:903
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: SpectrumCanvas.h:789
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:118
IntensityModes getIntensityMode() const
Returns the intensity mode.
Definition: SpectrumCanvas.h:200
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:55
bool isMzToXAxis()
Returns the mapping of m/z to axes.
Definition: SpectrumCanvas.h:317
LayerData & getCurrentLayer()
returns the layer data of the active layer
Definition: SpectrumCanvas.h:251
float getCurrentMinIntensity() const
Returns the minimum intensity of the active layer.
Definition: SpectrumCanvas.h:388
An LC-MS feature.
Definition: Feature.h:70
bool getLayerFlag(LayerData::Flags f) const
returns a layer flag of the current layer
Definition: SpectrumCanvas.h:258
Logarithmic mode.
Definition: SpectrumCanvas.h:148
void setCurrentLayerParameters(const Param ¶m)
Sets the parameters of the current layer.
Definition: SpectrumCanvas.h:462
Management and storage of parameters / INI files.
Definition: Param.h:75
void setLayerFlag(Size layer, LayerData::Flags f, bool value)
sets a layer flag of the layer layer
Definition: SpectrumCanvas.h:277
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
QRubberBand rubber_band_
Rubber band for selected area.
Definition: SpectrumCanvas.h:923
double percentage_factor_
Intensity scaling factor for relative scale with multiple layers.
Definition: SpectrumCanvas.h:913
Normal mode: f(x)=x.
Definition: SpectrumCanvas.h:145
static String getVersion()
Return the version number of OpenMS.
DRange< 2 > AreaType
Types of Ranges/Areas.
Definition: SpectrumCanvas.h:131
Int getActionMode() const
Returns the action mode.
Definition: SpectrumCanvas.h:188
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features)
Definition: SpectrumCanvas.h:113
QMenu * context_add_
External context menu extension.
Definition: SpectrumCanvas.h:926
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
FeatureMapType::FeatureType FeatureType
Feature type.
Definition: SpectrumCanvas.h:126
translate
Definition: SpectrumCanvas.h:137
LabelType
Label used in visualization.
Definition: LayerData.h:95
IntensityModes intensity_mode_
Stores the used intensity mode function.
Definition: SpectrumCanvas.h:835
Spectrum profile or centroided data.
Definition: LayerData.h:70
Size getCurrentLayerIndex() const
returns the index of the active layer
Definition: SpectrumCanvas.h:245
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
IntensityModes
Display modes of intensity.
Definition: SpectrumCanvas.h:143
static DateTime now()
Returns the current date and time.
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: SpectrumCanvas.h:107
ActionModes action_mode_
Stores the current action mode (Pick, Zoom, Translate)
Definition: SpectrumCanvas.h:832
AreaType visible_area_
Stores the currently visible area.
Definition: SpectrumCanvas.h:849
std::vector< AreaType > zoom_stack_
The zoom stack.
Definition: SpectrumCanvas.h:875
int Int
Signed integer type.
Definition: Types.h:103
const LayerData & getCurrentLayer() const
returns the layer data of the active layer
Definition: SpectrumCanvas.h:238
Class that stores the data for one layer.
Definition: LayerData.h:62
Index of a peak or feature.
Definition: PeakIndex.h:51
const LayerData & getLayer(Size index) const
returns the layer data with index index
Definition: SpectrumCanvas.h:231
QPoint last_mouse_pos_
start position of mouse actions
Definition: SpectrumCanvas.h:906
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: SpectrumCanvas.h:120