OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
data_viewer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  Authors: Ansgar Philippsen, Andreas Schenk, Jeff Lovelace
23 */
24 
25 #ifndef IMG_GUI_DATA_VIEWER_H
26 #define IMG_GUI_DATA_VIEWER_H
27 
28 #ifndef Q_MOC_RUN
29 
30 #include <map>
31 
32 #include <ost/base.hh>
33 #include <ost/img/data.hh>
34 #include <ost/img/data_observer.hh>
35 #include <ost/img/alg/norm.hh>
36 
37 #include <ost/gui/main_window.hh>
38 
39 #include "overlay_base_fw.hh"
40 #include "overlay_manager_fw.hh"
41 #include "overlay_manager_gui.hh"
42 #include "argand.hh"
43 #include "info_panel.hh"
44 #include "fft_panel.hh"
45 #include <ost/gui/module_config.hh>
46 
47 #endif
48 
49 
50 //fw decl
51 class QLabel;
52 
53 namespace ost {
54 
55 namespace gui {
56 class GostyApp;
57 } //ns
58 
59 namespace img { namespace gui {
60 
61 //fw decl
62 class DataViewerPanel;
63 
66 {
67  Q_OBJECT;
68 
69  friend class ost::gui::GostyApp; // for creation
70 
71 public:
72  virtual ~DataViewer();
73 
75  void SetData(const ImageHandle& data);
76 
78  const ImageHandle& GetData() const;
79 
81  NormalizerPtr GetNormalizer() const;
82 
84  void Renormalize();
85 
86  void Recenter();
87 
89  Extent GetSelection() const;
90 
92  void SetSelection(const Extent& selection);
93 
95  void SetName(const String& name);
96 
98  int AddOverlay(const OverlayPtr& ov, bool make_active=true);
99 
101  void ClearOverlays();
102 
104  void ClearActiveOverlay();
105 
107  OverlayManagerPtr GetOverlayManager() const;
108 
110  virtual void OnPanelMouseEvent(QMouseEvent* e);
111 
113  void SetAntialiasing(bool f);
114 
116  virtual bool eventFilter(QObject * object, QEvent *event);
117 
119  void SetSlab(int slab);
121  int GetSlab() const;
122 
124  void SetZoomScale(Real zoomscale);
126  Real GetZoomScale() const;
127 
129  void SetViewerMin(Real min);
131  Real GetViewerMin() const;
132 
134  void SetViewerMax(Real max);
136  Real GetViewerMax() const;
137 
139  void SetGamma(Real gamma);
141  Real GetGamma() const;
142 
144  void SetInvert(bool invert);
146  bool GetInvert() const;
147 
149  void SetOffset(const geom::Vec2& offset);
151  geom::Vec2 GetOffset() const;
152 
153  QButtonGroup* GetButtonGroup(void);
154 
155 signals:
156  void released();
157 
158 public slots:
160  void UpdateView();
161 
162  void OnSlabChange(int slab);
163  void OnZoomChange(int zoomlevel);
164 
165  protected:
167  DataViewer(QWidget* p, const ImageHandle& data, const QString& name="");
168 
169  private:
170  // inhibit coping and assignement
171  DataViewer(const DataViewer& v);
172 
173  DataViewer& operator=(const DataViewer& v) {return *this;}
174 
175  QString name_;
176  DataViewerPanel* panel_;
177 
178  OverlayManagerPtr ov_manager_;
179  OverlayManagerGUI* ov_manager_gui_;
180 
181  InfoPanel* info_;
182  Argand* argand_;
183  FFTPanel* fft_;
184 
185  QLabel* zoomlabel_;
186  QLabel* slablabel_;
187  QPoint lastmouse_;
188 
189  void build(const ImageHandle& data);
190 
191  void show_current_window_menu(void);
192 
193 
194  void build_menu();
195 };
196 
197 }}} //ns
198 
199 #endif
boost::shared_ptr< NormalizerImpl > NormalizerPtr
boost::shared_ptr< Overlay > OverlayPtr
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
#define DLLEXPORT_OST_GUI
Defines lower and upper valid indices.
Definition: extent.hh:60
Manage shared instances of images.
boost::shared_ptr< OverlayManager > OverlayManagerPtr