iRoCS Toolbox  1.1.0
OrthoViewPlane.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef ORTHOVIEWPLANE_HH
26 #define ORTHOVIEWPLANE_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include <QtGui/QWidget>
33 
34 #include <blitz/array.h>
35 
36 #include <map>
37 #include <list>
38 
40 
41 class QWheelEvent;
42 class QMouseEvent;
43 class QXmlStreamWriter;
44 
45 class OrthoViewWidget;
46 class OrthoViewOverlay;
47 class ChannelSpecs;
49 
50 class OrthoViewPlane : public QWidget
51 {
52 
53  Q_OBJECT
54 
55  public:
56 
59  QWidget* parent = NULL);
61 
62  void addOverlay(OrthoViewOverlay* overlay);
63  void removeOverlay(OrthoViewOverlay* overlay);
64 
65 /*======================================================================*/
76 /*======================================================================*/
77  blitz::TinyVector<double,3> mousePositionUm(int x, int y) const;
78  blitz::TinyVector<double,3> mousePositionPx(int x, int y) const;
79 
81  blitz::TinyVector<int,2> const &dimensions() const;
82  int orthogonalDimension() const;
83  std::string viewId() const;
84 
85  void paint(QPainter &painter);
86  void paint(
87  QXmlStreamWriter &svgStream,
88  blitz::TinyVector<double,3> const &shapePx,
89  blitz::TinyVector<double,3> const &lowerBoundUm,
90  blitz::TinyVector<double,3> const &upperBoundUm,
91  std::string const &font, double fontSizePt,
92  iRoCS::ProgressReporter *pr = NULL);
93 
94  blitz::Array<blitz::TinyVector<unsigned char,4>,2> const &image() const;
95 
96 public slots:
97 
98  void adjustSize();
99 
100 /*======================================================================*/
106 /*======================================================================*/
107  void updateData();
108 
109 private:
110 
111  void paintEvent(QPaintEvent*);
112  void mousePressEvent(QMouseEvent* e);
113  void mouseMoveEvent(QMouseEvent* e);
114  void mouseReleaseEvent(QMouseEvent* e);
115  void wheelEvent(QWheelEvent* e);
116 
117  OrthoViewWidget* p_orthoView;
118  blitz::Array<blitz::TinyVector<unsigned char,4>,2> _data;
119  blitz::TinyVector<int,2> _dimensions;
120  int _orthogonalDimension;
121 
122  bool _dragVertical, _dragHorizontal, _isDragging;
123 
124  std::list<OrthoViewOverlay*> _overlays;
125 
126 };
127 
128 #endif
void removeOverlay(OrthoViewOverlay *overlay)
blitz::Array< blitz::TinyVector< unsigned char, 4 >, 2 > const & image() const
OrthoViewWidget * orthoView()
void addOverlay(OrthoViewOverlay *overlay)
blitz::TinyVector< int, 2 > const & dimensions() const
OrthoViewPlane(OrthoViewWidget *orthoView, int orthogonalDimension, QWidget *parent=NULL)
std::string viewId() const
int orthogonalDimension() const
blitz::TinyVector< double, 3 > mousePositionPx(int x, int y) const
void paint(QPainter &painter)
void updateData()
Repaint the RGB Array containing the fused information of all Data, Visualization and RGBChannels...
blitz::TinyVector< double, 3 > mousePositionUm(int x, int y) const
Get the absolute micrometer position in the volume for the given screen coordinates.