38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h> 49 #include <QRubberBand> 174 spectrum_widget_ = widget;
185 return spectrum_widget_;
208 return intensity_mode_;
222 intensity_mode_ = mod;
223 intensityModeChange_();
239 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer(index) index overflow");
240 return layers_[index];
246 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
247 return layers_[current_layer_];
253 return current_layer_;
259 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
260 return layers_[current_layer_];
266 return getLayerFlag(current_layer_, f);
272 setLayerFlag(current_layer_, f, value);
278 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::getLayerFlag() index overflow");
279 return layers_[layer].flags.test(f);
286 if (layers_.empty())
return;
288 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::setLayerFlag() index overflow");
290 layers_[layer].flags.set(f, value);
291 update_buffer_ =
true;
298 if (layers_.empty())
return;
300 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::setLabel() index overflow");
301 layers_[current_layer_].label = label;
303 update_buffer_ =
true;
314 return visible_area_;
320 virtual void setFilters(
const DataFilters & filters);
325 return mz_to_x_axis_;
329 void mzToXAxis(
bool mz_to_x_axis);
337 inline Size getLayerCount()
const 340 return layers_.size();
344 Size activeLayerIndex()
const;
346 virtual void activateLayer(
Size layer_index) = 0;
348 virtual void removeLayer(
Size layer_index) = 0;
363 bool addLayer(ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map,
const String & filename =
"");
373 bool addLayer(FeatureMapSharedPtrType map,
const String & filename =
"");
383 bool addLayer(ConsensusMapSharedPtrType map,
const String & filename =
"");
394 bool addLayer(std::vector<PeptideIdentification> & peptides,
395 const String & filename =
"");
402 return getCurrentLayer().getPeakData()->getMinInt();
406 return getCurrentLayer().getFeatureMap()->getMinInt();
410 return getCurrentLayer().getConsensusMap()->getMinInt();
419 return getCurrentLayer().getPeakData()->getMaxInt();
423 return getCurrentLayer().getFeatureMap()->getMaxInt();
427 return getCurrentLayer().getConsensusMap()->getMaxInt();
436 return getLayer(index).getPeakData()->getMinInt();
440 return getLayer(index).getFeatureMap()->getMinInt();
444 return getLayer(index).getConsensusMap()->getMinInt();
453 return getLayer(index).getPeakData()->getMaxInt();
457 return getLayer(index).getFeatureMap()->getMaxInt();
461 return getLayer(index).getConsensusMap()->getMaxInt();
466 void setLayerName(
Size i,
const String & name);
474 getCurrentLayer_().param = param;
475 emit preferencesChange();
490 double getSnapFactor();
493 double getPercentageFactor();
496 virtual void showCurrentLayerPreferences() = 0;
504 virtual void showMetaData(
bool modifiable =
false,
Int index = -1);
511 virtual void saveCurrentLayer(
bool visible) = 0;
521 void changeVisibility(
Size i,
bool b);
529 void changeLayerFilterState(
Size i,
bool b);
537 void showGridLines(
bool show);
546 void resetZoom(
bool repaint =
true);
554 void setVisibleArea(AreaType area);
561 virtual void horizontalScrollBarChange(
int value);
568 virtual void verticalScrollBarChange(
int value);
571 void setAdditionalContextMenu(QMenu * menu);
580 void getVisiblePeakData(ExperimentType & map)
const;
590 void getVisibleFeatureData(FeatureMapType & map)
const;
599 void getVisibleConsensusData(ConsensusMapType & map)
const;
608 void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides)
const;
611 virtual void updateLayer(
Size i) = 0;
616 void layerModficationChange(
Size layer,
bool modified);
619 void layerActivated(
QWidget * w);
622 void layerZoomChanged(
QWidget * w);
633 void sendCursorStatus(
double mz = -1.0,
double rt = -1.0);
636 void sendStatusMessage(std::string message,
OpenMS::UInt time);
639 void recalculateAxes();
642 void updateVScrollbar(
float,
float,
float,
float);
645 void updateHScrollbar(
float,
float,
float,
float);
648 void changeLegendVisibility();
651 void actionModeChange();
654 void preferencesChange();
659 void updateCursor_();
664 void drawText_(QPainter & painter, QStringList text);
667 double getIdentificationMZ_(
const Size layer_index,
671 virtual bool finishAdding_() = 0;
676 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer_(index) index overflow");
677 return layers_[index];
683 return getLayer_(current_layer_);
688 void resizeEvent(QResizeEvent * e)
override;
689 void wheelEvent(QWheelEvent * e)
override;
690 void keyPressEvent(QKeyEvent * e)
override;
691 void keyReleaseEvent(QKeyEvent * e)
override;
692 void focusOutEvent(QFocusEvent * e)
override;
693 void leaveEvent(QEvent * e)
override;
694 void enterEvent(QEvent * e)
override;
698 virtual void intensityModeChange_();
710 virtual void changeVisibleArea_(
const AreaType & new_area,
bool repaint =
true,
bool add_to_stack =
false);
717 virtual void recalculateSnapFactor_();
721 virtual void zoom_(
int x,
int y,
bool zoom_in);
726 virtual void zoomForward_();
728 void zoomAdd_(
const AreaType & area);
735 virtual void translateLeft_(Qt::KeyboardModifiers m);
738 virtual void translateRight_(Qt::KeyboardModifiers m);
740 virtual void translateForward_();
742 virtual void translateBackward_();
750 virtual void updateScrollbars_();
766 visible_area_.minX() + (height() - y) / height() * visible_area_.width(),
767 visible_area_.minY() + x / width() * visible_area_.height()
773 visible_area_.minX() + x / width() * visible_area_.width(),
774 visible_area_.minY() + (height() - y) / height() * visible_area_.height()
782 return widgetToData_(pos.x(), pos.y());
801 point.setX(
int((y - visible_area_.minY()) / visible_area_.height() * width()));
806 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
810 point.setY(height() -
int((x - visible_area_.minX()) / visible_area_.width() * height()));
814 point.setX(
int((x - visible_area_.minX()) / visible_area_.width() * width()));
818 point.setY(height() -
int((y - visible_area_.minY()) / visible_area_.height() * height()));
822 point.setY(height() -
int(
823 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
830 virtual void paintGridLines_(QPainter & painter);
864 void recalculateRanges_(
UInt mz_dim,
UInt rt_dim,
UInt it_dim);
892 virtual void update_(
const char * caller_name);
895 void modificationStatus_(
Size layer_index,
bool modified);
904 void adjustBuffer_();
943 std::set<DataProcessing::ProcessingAction> actions;
944 actions.insert(action);
948 p->setProcessingActions(actions);
950 p->getSoftware().setName(
"SpectrumCanvas");
956 for (
Size i = 0; i < map.
size(); ++i)
958 map[i].getDataProcessing().push_back(p);
float getCurrentMaxIntensity() const
Returns the maximum intensity of the active layer.
Definition: SpectrumCanvas.h:415
Flags
Flags that determine which information is shown.
Definition: LayerData.h:102
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
bool show_grid_
Stores whether or not to show a grid.
Definition: SpectrumCanvas.h:876
bool update_buffer_
Whether to recalculate the data in the buffer when repainting.
Definition: SpectrumCanvas.h:898
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition: SpectrumCanvas.h:113
float getMaxIntensity(Size index) const
Returns the maximum intensity of the layer with index index.
Definition: SpectrumCanvas.h:449
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: SpectrumCanvas.h:117
float getMinIntensity(Size index) const
Returns the minimum intensity of the layer with index index.
Definition: SpectrumCanvas.h:432
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:135
std::vector< AreaType >::iterator zoom_pos_
The current position in the zoom stack.
Definition: SpectrumCanvas.h:881
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks)
Definition: SpectrumCanvas.h:128
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:924
DPosition< 2 > PointType
Type of the Points.
Definition: SpectrumCanvas.h:135
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
Definition: SpectrumCanvas.h:152
const AreaType & getVisibleArea() const
Returns the currently visible area.
Definition: SpectrumCanvas.h:312
bool show_timing_
Flag that determines if timing data is printed to the command line.
Definition: SpectrumCanvas.h:933
std::vector< LayerData > layers_
Layer data.
Definition: SpectrumCanvas.h:842
SpectrumWidget * getSpectrumWidget() const
Returns the spectrum widget.
Definition: SpectrumCanvas.h:183
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos.
Definition: SpectrumCanvas.h:780
LayerData & getLayer_(Size index)
Returns the layer with index index.
Definition: SpectrumCanvas.h:674
LayerData::ConsensusMapType ConsensusMapType
Main data type (consensus features)
Definition: SpectrumCanvas.h:121
QImage buffer_
Buffer that stores the actual peak information.
Definition: SpectrumCanvas.h:833
bool getLayerFlag(Size layer, LayerData::Flags f) const
returns a layer flag of the layer layer
Definition: SpectrumCanvas.h:276
A container for features.
Definition: FeatureMap.h:93
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:106
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
DRange< 3 > overall_data_range_
Stores the data range (m/z, RT and intensity) of all layers.
Definition: SpectrumCanvas.h:873
ActionModes
Mouse action modes.
Definition: SpectrumCanvas.h:141
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features)
Definition: SpectrumCanvas.h:123
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:103
bool mz_to_x_axis_
Stores the mapping of m/z.
Definition: SpectrumCanvas.h:845
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:100
A container for consensus elements.
Definition: ConsensusMap.h:75
boost::shared_ptr< const ExperimentType > ConstExperimentSharedPtrType
Definition: LayerData.h:149
void addDataProcessing_(PeakMap &map, DataProcessing::ProcessingAction action) const
Data processing setter for peak maps.
Definition: SpectrumCanvas.h:941
void setLabel(LayerData::LabelType label)
Definition: SpectrumCanvas.h:295
zoom
Definition: SpectrumCanvas.h:144
bool gridLinesShown() const
Returns if the grid is currently shown.
Definition: SpectrumCanvas.h:231
Size size() const
Definition: MSExperiment.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
SpectrumType::PeakType PeakType
Peak type.
Definition: SpectrumCanvas.h:130
void setSpectrumWidget(SpectrumWidget *widget)
Sets the spectrum widget.
Definition: SpectrumCanvas.h:172
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:147
Chromatogram data.
Definition: LayerData.h:96
PeakIndex selected_peak_
selected peak
Definition: SpectrumCanvas.h:936
void setLayerFlag(LayerData::Flags f, bool value)
sets a layer flag of the current layer
Definition: SpectrumCanvas.h:270
Shows the maximum displayed intensity as if it was the overall maximum intensity. ...
Definition: SpectrumCanvas.h:153
Size current_layer_
Stores the index of the currently active layer.
Definition: SpectrumCanvas.h:901
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
LayerData & getCurrentLayer_()
Returns the currently active layer.
Definition: SpectrumCanvas.h:681
PeakIndex measurement_start_
start peak of measuring mode
Definition: SpectrumCanvas.h:938
LayerData::ConstExperimentSharedPtrType ConstExperimentSharedPtrType
Definition: SpectrumCanvas.h:114
Feature data.
Definition: LayerData.h:94
PointType widgetToData_(double x, double y)
Convert widget to chart coordinates.
Definition: SpectrumCanvas.h:761
void setIntensityMode(IntensityModes mod)
Sets the intensity mode.
Definition: SpectrumCanvas.h:220
ProcessingAction
Definition: DataProcessing.h:58
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:126
SpectrumWidget * spectrum_widget_
Back-pointer to the enclosing spectrum widget.
Definition: SpectrumCanvas.h:907
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: SpectrumCanvas.h:793
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:141
IntensityModes getIntensityMode() const
Returns the intensity mode.
Definition: SpectrumCanvas.h:206
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
bool isMzToXAxis()
Returns the mapping of m/z to axes.
Definition: SpectrumCanvas.h:323
LayerData & getCurrentLayer()
returns the layer data of the active layer
Definition: SpectrumCanvas.h:257
float getCurrentMinIntensity() const
Returns the minimum intensity of the active layer.
Definition: SpectrumCanvas.h:398
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:264
Logarithmic mode.
Definition: SpectrumCanvas.h:154
void setCurrentLayerParameters(const Param ¶m)
Sets the parameters of the current layer.
Definition: SpectrumCanvas.h:472
Management and storage of parameters / INI files.
Definition: Param.h:74
void setLayerFlag(Size layer, LayerData::Flags f, bool value)
sets a layer flag of the layer layer
Definition: SpectrumCanvas.h:283
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
QRubberBand rubber_band_
Rubber band for selected area.
Definition: SpectrumCanvas.h:927
double percentage_factor_
Intensity scaling factor for relative scale with multiple layers.
Definition: SpectrumCanvas.h:917
Normal mode: f(x)=x.
Definition: SpectrumCanvas.h:151
static String getVersion()
Return the version number of OpenMS.
DRange< 2 > AreaType
Types of Ranges/Areas.
Definition: SpectrumCanvas.h:137
Int getActionMode() const
Returns the action mode.
Definition: SpectrumCanvas.h:194
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features)
Definition: SpectrumCanvas.h:119
QMenu * context_add_
External context menu extension.
Definition: SpectrumCanvas.h:930
boost::shared_ptr< OnDiscMSExperiment > ODExperimentSharedPtrType
SharedPtr on On-Disc MSExperiment.
Definition: LayerData.h:152
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
FeatureMapType::FeatureType FeatureType
Feature type.
Definition: SpectrumCanvas.h:132
translate
Definition: SpectrumCanvas.h:143
LabelType
Label used in visualization.
Definition: LayerData.h:118
IntensityModes intensity_mode_
Stores the used intensity mode function.
Definition: SpectrumCanvas.h:839
Spectrum profile or centroided data.
Definition: LayerData.h:93
Size getCurrentLayerIndex() const
returns the index of the active layer
Definition: SpectrumCanvas.h:251
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
IntensityModes
Display modes of intensity.
Definition: SpectrumCanvas.h:149
static DateTime now()
Returns the current date and time.
DataFilter array providing some convenience functions.
Definition: DataFilters.h:50
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: SpectrumCanvas.h:111
ActionModes action_mode_
Stores the current action mode (Pick, Zoom, Translate)
Definition: SpectrumCanvas.h:836
AreaType visible_area_
Stores the currently visible area.
Definition: SpectrumCanvas.h:853
std::vector< AreaType > zoom_stack_
The zoom stack.
Definition: SpectrumCanvas.h:879
int Int
Signed integer type.
Definition: Types.h:102
const LayerData & getCurrentLayer() const
returns the layer data of the active layer
Definition: SpectrumCanvas.h:244
Class that stores the data for one layer.
Definition: LayerData.h:85
Index of a peak or feature.
Definition: PeakIndex.h:50
const LayerData & getLayer(Size index) const
returns the layer data with index index
Definition: SpectrumCanvas.h:237
QPoint last_mouse_pos_
start position of mouse actions
Definition: SpectrumCanvas.h:910
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:62
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: SpectrumCanvas.h:126
LayerData::ODExperimentSharedPtrType ODExperimentSharedPtrType
Definition: SpectrumCanvas.h:115