|
OpenMS
2.6.0
|
Go to the documentation of this file.
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
49 #include <QRubberBand>
172 spectrum_widget_ = widget;
183 return spectrum_widget_;
206 return intensity_mode_;
220 intensity_mode_ = mod;
221 intensityModeChange_();
237 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer(index) index overflow");
238 return layers_[index];
244 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
245 return layers_[current_layer_];
251 return current_layer_;
257 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::getCurrentLayer() index overflow");
258 return layers_[current_layer_];
264 return getLayerFlag(current_layer_, f);
270 setLayerFlag(current_layer_, f, value);
276 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::getLayerFlag() index overflow");
277 return layers_[layer].flags.test(f);
284 if (layers_.empty())
return;
286 OPENMS_PRECONDITION(layer < layers_.size(),
"SpectrumCanvas::setLayerFlag() index overflow");
288 layers_[layer].flags.set(f, value);
289 update_buffer_ =
true;
296 if (layers_.empty())
return;
298 OPENMS_PRECONDITION(current_layer_ < layers_.size(),
"SpectrumCanvas::setLabel() index overflow");
299 layers_[current_layer_].label = label;
301 update_buffer_ =
true;
312 return visible_area_;
318 virtual void setFilters(
const DataFilters & filters);
323 return mz_to_x_axis_;
327 void mzToXAxis(
bool mz_to_x_axis);
335 inline Size getLayerCount()
const
338 return layers_.size();
342 Size activeLayerIndex()
const;
344 virtual void activateLayer(
Size layer_index) = 0;
346 virtual void removeLayer(
Size layer_index) = 0;
361 bool addLayer(ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map,
const String & filename =
"");
371 bool addLayer(FeatureMapSharedPtrType map,
const String & filename =
"");
381 bool addLayer(ConsensusMapSharedPtrType map,
const String & filename =
"");
392 bool addLayer(std::vector<PeptideIdentification> & peptides,
393 const String & filename =
"");
400 return getCurrentLayer().getPeakData()->getMinInt();
404 return getCurrentLayer().getFeatureMap()->getMinInt();
408 return getCurrentLayer().getConsensusMap()->getMinInt();
417 return getCurrentLayer().getPeakData()->getMaxInt();
421 return getCurrentLayer().getFeatureMap()->getMaxInt();
425 return getCurrentLayer().getConsensusMap()->getMaxInt();
434 return getLayer(index).getPeakData()->getMinInt();
438 return getLayer(index).getFeatureMap()->getMinInt();
442 return getLayer(index).getConsensusMap()->getMinInt();
451 return getLayer(index).getPeakData()->getMaxInt();
455 return getLayer(index).getFeatureMap()->getMaxInt();
459 return getLayer(index).getConsensusMap()->getMaxInt();
464 void setLayerName(
Size i,
const String & name);
472 getCurrentLayer_().param = param;
473 emit preferencesChange();
488 double getSnapFactor();
491 double getPercentageFactor();
494 virtual void showCurrentLayerPreferences() = 0;
502 virtual void showMetaData(
bool modifiable =
false,
Int index = -1);
509 virtual void saveCurrentLayer(
bool visible) = 0;
519 void changeVisibility(
Size i,
bool b);
527 void changeLayerFilterState(
Size i,
bool b);
535 void showGridLines(
bool show);
544 void resetZoom(
bool repaint =
true);
552 void setVisibleArea(AreaType area);
559 virtual void horizontalScrollBarChange(
int value);
566 virtual void verticalScrollBarChange(
int value);
569 void setAdditionalContextMenu(QMenu * menu);
578 void getVisiblePeakData(ExperimentType & map)
const;
588 void getVisibleFeatureData(FeatureMapType & map)
const;
597 void getVisibleConsensusData(ConsensusMapType & map)
const;
606 void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides)
const;
609 virtual void updateLayer(
Size i) = 0;
614 void layerModficationChange(
Size layer,
bool modified);
617 void layerActivated(
QWidget * w);
620 void layerZoomChanged(
QWidget * w);
631 void sendCursorStatus(
double mz = -1.0,
double rt = -1.0);
634 void sendStatusMessage(std::string message,
OpenMS::UInt time);
637 void recalculateAxes();
640 void updateVScrollbar(
float,
float,
float,
float);
643 void updateHScrollbar(
float,
float,
float,
float);
646 void changeLegendVisibility();
649 void actionModeChange();
652 void preferencesChange();
657 void updateCursor_();
662 void drawText_(QPainter & painter, QStringList text);
665 double getIdentificationMZ_(
const Size layer_index,
669 virtual bool finishAdding_() = 0;
673 void popIncompleteLayer_(
const QString& error_message =
"");
678 OPENMS_PRECONDITION(index < layers_.size(),
"SpectrumCanvas::getLayer_(index) index overflow");
679 return layers_[index];
685 return getLayer_(current_layer_);
690 void resizeEvent(QResizeEvent * e)
override;
691 void wheelEvent(QWheelEvent * e)
override;
692 void keyPressEvent(QKeyEvent * e)
override;
693 void keyReleaseEvent(QKeyEvent * e)
override;
694 void focusOutEvent(QFocusEvent * e)
override;
695 void leaveEvent(QEvent * e)
override;
696 void enterEvent(QEvent * e)
override;
700 virtual void intensityModeChange_();
712 virtual void changeVisibleArea_(
const AreaType & new_area,
bool repaint =
true,
bool add_to_stack =
false);
719 virtual void recalculateSnapFactor_();
723 virtual void zoom_(
int x,
int y,
bool zoom_in);
728 virtual void zoomForward_();
730 void zoomAdd_(
const AreaType & area);
737 virtual void translateLeft_(Qt::KeyboardModifiers m);
740 virtual void translateRight_(Qt::KeyboardModifiers m);
742 virtual void translateForward_();
744 virtual void translateBackward_();
752 virtual void updateScrollbars_();
768 visible_area_.minX() + (height() - y) / height() * visible_area_.width(),
769 visible_area_.minY() + x / width() * visible_area_.height()
775 visible_area_.minX() + x / width() * visible_area_.width(),
776 visible_area_.minY() + (height() - y) / height() * visible_area_.height()
784 return widgetToData_(pos.x(), pos.y());
803 point.setX(
int((y - visible_area_.minY()) / visible_area_.height() * width()));
808 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
812 point.setY(height() -
int((x - visible_area_.minX()) / visible_area_.width() * height()));
816 point.setX(
int((x - visible_area_.minX()) / visible_area_.width() * width()));
820 point.setY(height() -
int((y - visible_area_.minY()) / visible_area_.height() * height()));
824 point.setY(height() -
int(
825 std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
832 virtual void paintGridLines_(QPainter & painter);
866 void recalculateRanges_(
UInt mz_dim,
UInt rt_dim,
UInt it_dim);
894 virtual void update_(
const char * caller_name);
897 void modificationStatus_(
Size layer_index,
bool modified);
906 void adjustBuffer_();
945 std::set<DataProcessing::ProcessingAction> actions;
946 actions.insert(action);
950 p->setProcessingActions(actions);
952 p->getSoftware().setName(
"SpectrumCanvas");
958 for (
Size i = 0; i < map.
size(); ++i)
960 map[i].getDataProcessing().push_back(p);
LayerData::ConstExperimentSharedPtrType ConstExperimentSharedPtrType
Definition: SpectrumCanvas.h:112
AreaType visible_area_
Stores the currently visible area.
Definition: SpectrumCanvas.h:855
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
Definition: SpectrumCanvas.h:150
LayerData & getLayer_(Size index)
Returns the layer with index index.
Definition: SpectrumCanvas.h:676
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:149
ActionModes
Mouse action modes.
Definition: SpectrumCanvas.h:139
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos.
Definition: SpectrumCanvas.h:782
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: SpectrumCanvas.h:124
bool getLayerFlag(Size layer, LayerData::Flags f) const
returns a layer flag of the layer layer
Definition: SpectrumCanvas.h:274
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:137
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: SpectrumCanvas.h:795
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:143
void addDataProcessing_(PeakMap &map, DataProcessing::ProcessingAction action) const
Data processing setter for peak maps.
Definition: SpectrumCanvas.h:943
void setLabel(LayerData::LabelType label)
Definition: SpectrumCanvas.h:293
DRange< 2 > AreaType
Types of Ranges/Areas.
Definition: SpectrumCanvas.h:135
LayerData & getCurrentLayer()
returns the layer data of the active layer
Definition: SpectrumCanvas.h:255
DPosition< 2 > PointType
Type of the Points.
Definition: SpectrumCanvas.h:133
Logarithmic mode.
Definition: SpectrumCanvas.h:152
boost::shared_ptr< const ExperimentType > ConstExperimentSharedPtrType
Definition: LayerData.h:151
A more convenient string class.
Definition: String.h:59
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
const AreaType & getVisibleArea() const
Returns the currently visible area.
Definition: SpectrumCanvas.h:310
std::vector< LayerData > layers_
Layer data.
Definition: SpectrumCanvas.h:844
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features)
Definition: SpectrumCanvas.h:121
PeakIndex selected_peak_
selected peak
Definition: SpectrumCanvas.h:938
Flags
Flags that determine which information is shown.
Definition: LayerData.h:103
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:136
bool mz_to_x_axis_
Stores the mapping of m/z.
Definition: SpectrumCanvas.h:847
IntensityModes
Display modes of intensity.
Definition: SpectrumCanvas.h:147
std::vector< AreaType > zoom_stack_
The zoom stack.
Definition: SpectrumCanvas.h:881
Size size() const
Definition: MSExperiment.h:127
Feature data.
Definition: LayerData.h:96
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
const LayerData & getCurrentLayer() const
returns the layer data of the active layer
Definition: SpectrumCanvas.h:242
static DateTime now()
Returns the current date and time.
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:135
PointType widgetToData_(double x, double y)
Convert widget to chart coordinates.
Definition: SpectrumCanvas.h:763
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: SpectrumCanvas.h:109
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
ProcessingAction
Definition: DataProcessing.h:58
IntensityModes intensity_mode_
Stores the used intensity mode function.
Definition: SpectrumCanvas.h:841
Spectrum profile or centroided data.
Definition: LayerData.h:94
const LayerData & getLayer(Size index) const
returns the layer data with index index
Definition: SpectrumCanvas.h:235
Index of a peak or feature.
Definition: PeakIndex.h:50
void setLayerFlag(LayerData::Flags f, bool value)
sets a layer flag of the current layer
Definition: SpectrumCanvas.h:268
Class that stores the data for one layer.
Definition: LayerData.h:85
Shows the maximum displayed intensity as if it was the overall maximum intensity.
Definition: SpectrumCanvas.h:151
QPoint last_mouse_pos_
start position of mouse actions
Definition: SpectrumCanvas.h:912
bool update_buffer_
Whether to recalculate the data in the buffer when repainting.
Definition: SpectrumCanvas.h:900
float getCurrentMaxIntensity() const
Returns the maximum intensity of the active layer.
Definition: SpectrumCanvas.h:413
PeakIndex measurement_start_
start peak of measuring mode
Definition: SpectrumCanvas.h:940
bool show_timing_
Flag that determines if timing data is printed to the command line.
Definition: SpectrumCanvas.h:935
std::vector< AreaType >::iterator zoom_pos_
The current position in the zoom stack.
Definition: SpectrumCanvas.h:883
LayerData::ConsensusMapType ConsensusMapType
Main data type (consensus features)
Definition: SpectrumCanvas.h:119
float getMinIntensity(Size index) const
Returns the minimum intensity of the layer with index index.
Definition: SpectrumCanvas.h:430
static String getVersion()
Return the version number of OpenMS.
QImage buffer_
Buffer that stores the actual peak information.
Definition: SpectrumCanvas.h:835
void setCurrentLayerParameters(const Param ¶m)
Sets the parameters of the current layer.
Definition: SpectrumCanvas.h:470
void setLayerFlag(Size layer, LayerData::Flags f, bool value)
sets a layer flag of the layer layer
Definition: SpectrumCanvas.h:281
Normal mode: f(x)=x.
Definition: SpectrumCanvas.h:149
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features)
Definition: SpectrumCanvas.h:117
IntensityModes getIntensityMode() const
Returns the intensity mode.
Definition: SpectrumCanvas.h:204
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
A container for consensus elements.
Definition: ConsensusMap.h:80
SpectrumWidget * getSpectrumWidget() const
Returns the spectrum widget.
Definition: SpectrumCanvas.h:181
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
bool isMzToXAxis()
Returns the mapping of m/z to axes.
Definition: SpectrumCanvas.h:321
std::vector< double > snap_factors_
Intensity scaling factor for 'snap to maximum intensity mode'.
Definition: SpectrumCanvas.h:926
SpectrumWidget * spectrum_widget_
Back-pointer to the enclosing spectrum widget.
Definition: SpectrumCanvas.h:909
Int getActionMode() const
Returns the action mode.
Definition: SpectrumCanvas.h:192
DRange< 3 > overall_data_range_
Stores the data range (m/z, RT and intensity) of all layers.
Definition: SpectrumCanvas.h:875
FeatureMapType::FeatureType FeatureType
Feature type.
Definition: SpectrumCanvas.h:130
bool getLayerFlag(LayerData::Flags f) const
returns a layer flag of the current layer
Definition: SpectrumCanvas.h:262
translate
Definition: SpectrumCanvas.h:141
A container for features.
Definition: FeatureMap.h:97
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:62
DataFilter array providing some convenience functions.
Definition: DataFilters.h:50
An LC-MS feature.
Definition: Feature.h:70
SpectrumType::PeakType PeakType
Peak type.
Definition: SpectrumCanvas.h:128
float getCurrentMinIntensity() const
Returns the minimum intensity of the active layer.
Definition: SpectrumCanvas.h:396
QRubberBand rubber_band_
Rubber band for selected area.
Definition: SpectrumCanvas.h:929
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
Size getCurrentLayerIndex() const
returns the index of the active layer
Definition: SpectrumCanvas.h:249
void setSpectrumWidget(SpectrumWidget *widget)
Sets the spectrum widget.
Definition: SpectrumCanvas.h:170
bool gridLinesShown() const
Returns if the grid is currently shown.
Definition: SpectrumCanvas.h:229
QMenu * context_add_
External context menu extension.
Definition: SpectrumCanvas.h:932
double percentage_factor_
Intensity scaling factor for relative scale with multiple layers.
Definition: SpectrumCanvas.h:919
Management and storage of parameters / INI files.
Definition: Param.h:73
ActionModes action_mode_
Stores the current action mode (Pick, Zoom, Translate)
Definition: SpectrumCanvas.h:838
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:98
LayerData::ODExperimentSharedPtrType ODExperimentSharedPtrType
Definition: SpectrumCanvas.h:113
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:128
LabelType
Label used in visualization.
Definition: LayerData.h:120
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: SpectrumCanvas.h:115
boost::shared_ptr< OnDiscMSExperiment > ODExperimentSharedPtrType
SharedPtr on On-Disc MSExperiment.
Definition: LayerData.h:154
LayerData & getCurrentLayer_()
Returns the currently active layer.
Definition: SpectrumCanvas.h:683
Size current_layer_
Stores the index of the currently active layer.
Definition: SpectrumCanvas.h:903
void setIntensityMode(IntensityModes mod)
Sets the intensity mode.
Definition: SpectrumCanvas.h:218
bool show_grid_
Stores whether or not to show a grid.
Definition: SpectrumCanvas.h:878
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition: SpectrumCanvas.h:111
float getMaxIntensity(Size index) const
Returns the maximum intensity of the layer with index index.
Definition: SpectrumCanvas.h:447
zoom
Definition: SpectrumCanvas.h:142
Chromatogram data.
Definition: LayerData.h:95
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks)
Definition: SpectrumCanvas.h:126