iRoCS Toolbox  1.1.0
OrthoViewWidget.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 ORTHOVIEWWIDGET_HH
26 #define ORTHOVIEWWIDGET_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include "ViewWidget.hh"
33 
34 #include <blitz/array.h>
35 
37 
38 class MultiChannelModel;
39 class OrthoViewPlane;
41 
42 class QScrollArea;
43 class QSplitter;
44 class QComboBox;
45 class QXmlStreamWriter;
46 
48 class IntControlElement;
49 
51 {
52 
53  Q_OBJECT
54 
55 public:
56 
57  OrthoViewWidget(MultiChannelModel* model, QWidget* parent = 0,
58  Qt::WindowFlags f = 0);
60 
62 
63  void addChannel(ChannelSpecs *channel);
64  void removeChannel(ChannelSpecs* channel);
65 
69 
70  OrthoViewPlane *orthoViewPlane(int orthogonalDimension);
71 
72  bool interpolation() const;
73  double zoom() const;
74  int fontSize() const;
75 
76 /*======================================================================*/
86 /*======================================================================*/
87  blitz::TinyVector<float,3> um2Px(
88  blitz::TinyVector<float,3> const &positionUm);
89 
90 /*======================================================================*/
98 /*======================================================================*/
99  double scaleToPx(double distanceUm);
100 
101 /*======================================================================*/
113 /*======================================================================*/
114  double um2Px(double positionUm, int dimension);
115 
116 /*======================================================================*/
126 /*======================================================================*/
127  blitz::TinyVector<float,3> px2Um(
128  blitz::TinyVector<float,3> const &positionPx);
129 
130 /*======================================================================*/
138 /*======================================================================*/
139  double scaleToUm(double distancePx);
140 
141 /*======================================================================*/
152 /*======================================================================*/
153  double px2Um(double positionPx, int dimension);
154 
155  void paint(QPainter &painter);
156  void paint(
157  QXmlStreamWriter &svgStream,
158  blitz::TinyVector<double,3> const &shapePx, double marginPx,
159  blitz::TinyVector<double,3> const &lowerBoundUm,
160  blitz::TinyVector<double,3> const &upperBoundUm,
161  double scaleBarLengthUm, std::string const &font, double fontSizePt,
162  iRoCS::ProgressReporter *pr = NULL);
163 
164 signals:
165 
166  void zoomChanged(double zoom);
167 
168 public slots:
169 
170  virtual void redraw();
171  void updateShape();
172  void setInterpolation(bool interpolation);
173  void setZoom(double zoom);
174  void updatePlaneData(
175  ChannelSpecsOrthoViewRenderer const *renderer, int direction);
176 
177 private slots:
178 
179  void resetZoom();
180  void zoomIn();
181  void zoomOut();
182  void updateZoomFromComboBox();
183  void updateZoomFromComboBox(QString const &str);
184  void setZoomInComboBox(double zoom);
185  void updatePositionUmFromControl();
186  void setPositionUmControlRangeFromModel();
187  void setPositionUmInControl(blitz::TinyVector<double,3> const &positionUm);
188  void synchronizeSplitters(int pos, int);
189  void updateCacheFontSize();
190 
191 private:
192 
193  blitz::TinyVector<double,3> _cachedPosition;
194  bool _interpolation;
195  double _zoom;
196 
197  QSplitter* p_vSplitter;
198  QSplitter* p_uhSplitter;
199  QSplitter* p_lhSplitter;
200  QScrollArea* p_xyScrollArea;
201  OrthoViewPlane* p_xyView;
202  QScrollArea* p_xzScrollArea;
203  OrthoViewPlane* p_xzView;
204  QScrollArea* p_zyScrollArea;
205  OrthoViewPlane* p_zyView;
206 
207  QAction *p_resetZoomAction;
208  QAction *p_zoomInAction;
209  QAction *p_zoomOutAction;
210  QComboBox *p_zoomControl;
211 
212  Double3ControlElement *p_crosshairPositionControl;
213  IntControlElement *p_fontSizeControl;
214 
215  friend class OrthoViewPlane;
216 
217 };
218 
219 #endif
void removeChannel(ChannelSpecs *channel)
blitz::TinyVector< double, 3 > positionUm() const
MultiChannelModel * model() const
void paint(QPainter &painter)
void zoomChanged(double zoom)
ViewWidget::ViewType viewType() const
blitz::TinyVector< float, 3 > um2Px(blitz::TinyVector< float, 3 > const &positionUm)
Get the pixel position of the given model position in micrometers in the view widget.
void setInterpolation(bool interpolation)
OrthoViewWidget(MultiChannelModel *model, QWidget *parent=0, Qt::WindowFlags f=0)
int fontSize() const
OrthoViewPlane * orthoViewPlane(int orthogonalDimension)
OrthoViewPlane * xyView()
void updatePlaneData(ChannelSpecsOrthoViewRenderer const *renderer, int direction)
double scaleToUm(double distancePx)
Get the micrometer distance for the given pixel distance in the view.
OrthoViewPlane * xzView()
void addChannel(ChannelSpecs *channel)
virtual void redraw()
bool interpolation() const
OrthoViewPlane * zyView()
blitz::TinyVector< float, 3 > px2Um(blitz::TinyVector< float, 3 > const &positionPx)
Get the model micrometer position of the given pixel position.
double scaleToPx(double distanceUm)
Get the pixel distance in the view for the given micrometer distance.
void setZoom(double zoom)
double zoom() const