OpenStructure
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-2020 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 
82 
84  void Renormalize();
85 
86  void Recenter();
87 
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 
102 
105 
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);
127 
129  void SetViewerMin(Real min);
132 
134  void SetViewerMax(Real max);
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);
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
Defines lower and upper valid indices.
Definition: extent.hh:60
Manage shared instances of images.
int AddOverlay(const OverlayPtr &ov, bool make_active=true)
add a new overlay
QButtonGroup * GetButtonGroup(void)
Real GetZoomScale() const
get zoom scale (range: 1e-8 to 1e8)
void OnZoomChange(int zoomlevel)
virtual void OnPanelMouseEvent(QMouseEvent *e)
internal use
void UpdateView()
update view
NormalizerPtr GetNormalizer() const
retrieve used normalizer
void SetData(const ImageHandle &data)
set new image or function to display
virtual bool eventFilter(QObject *object, QEvent *event)
event filter for DataViewerPanel
void SetViewerMax(Real max)
set maximum level of the viewer (e.g. the value that will be displayed as white)
void OnSlabChange(int slab)
Real GetViewerMin() const
get minimum level of the viewer (e.g. the value that will be displayed as black)
void SetSlab(int slab)
set z slab
bool GetInvert() const
get invert flag
Real GetGamma() const
get viewer gamma
geom::Vec2 GetOffset() const
get image offset
Extent GetSelection() const
return currently active selection
int GetSlab() const
get z slab
void SetZoomScale(Real zoomscale)
set zoom scale (range: 1e-8 to 1e8)
void ClearOverlays()
remove all overlays
void ClearActiveOverlay()
remove the active overlay
void Renormalize()
re-apply normalization using current normalizer
void SetGamma(Real gamma)
set viewer gamma
Real GetViewerMax() const
get maximum level of the viewer (e.g. the value that will be displayed as white)
void SetOffset(const geom::Vec2 &offset)
set image offset
void SetAntialiasing(bool f)
enable/disable antialiasing
DataViewer(QWidget *p, const ImageHandle &data, const QString &name="")
initialize with data to view, plus a name
void SetName(const String &name)
set the name, displayed as the window title
void SetSelection(const Extent &selection)
set currently active selection
const ImageHandle & GetData() const
get the current displayed image
OverlayManagerPtr GetOverlayManager() const
return the overlay manager for this viewer
void SetViewerMin(Real min)
set minimum level of the viewer (e.g. the value that will be displayed as black)
void SetInvert(bool invert)
set invert flag
#define DLLEXPORT_OST_GUI
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
boost::shared_ptr< OverlayManager > OverlayManagerPtr
boost::shared_ptr< Overlay > OverlayPtr
boost::shared_ptr< NormalizerImpl > NormalizerPtr
Definition: base.dox:1