SMIL  0.9.1
DQtImageViewer.hpp
1 /*
2  * Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Matthieu FAESSEL, or ARMINES nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 
30 #ifndef _D_QT_IMAGE_VIEWER_HPP
31 #define _D_QT_IMAGE_VIEWER_HPP
32 
33 #include <QApplication>
34 #include <QGraphicsSceneEvent>
35 
36 #include "Gui/include/private/DImageViewer.hpp"
37 #include "Core/include/DTypes.h"
38 
39 #include "PureQt/ImageViewerWidget.h"
40 
41 
42 class PlotWidget;
43 
44 namespace smil
45 {
46 
47  #define BASE_QT_VIEWER ImageViewerWidget
48 
49 
50  template <class T> class Image;
51 
56 
70  template <class T>
72 #ifndef SWIG
73  : public ImageViewer<T>, public BASE_QT_VIEWER
74 #endif // SWIG
75  {
76  public:
77  typedef ImageViewer<T> parentClass;
78  QtImageViewer();
80  ~QtImageViewer();
81 
82  virtual void setImage(Image<T> &im);
83  virtual void hide();
84  virtual void show();
85  virtual void showLabel();
86  virtual bool isVisible();
87  virtual void setName(const char *_name);
88  virtual void update();
89  virtual void saveSnapshot(const char *fileName);
90  virtual void redrawImage() // ImageViewerWidget
91  {
92  update();
93  }
94  void updateIcon()
95  {
96  if (!this->image)
97  return;
98 
99  BASE_QT_VIEWER::updateIcon();
100  }
101  virtual void drawOverlay(const Image<T> &im);
102  virtual void clearOverlay() { BASE_QT_VIEWER::clearOverlay(); }
103  virtual RES_T getOverlay(Image<T> &img);
104 
106  virtual void setLookup(const map<UINT8,RGB> &lut);
107  virtual void resetLookup();
108 
109  virtual void setCurSlice(int)
110  {
111  this->update();
112  }
113 
114  virtual void setLabelImage(bool val);
115 
116 #ifdef USE_QWT
117  virtual void displayHistogram(bool update=false);
118  virtual void displayProfile(bool update=false);
119 #endif // USE_QWT
120 
121  protected:
122  virtual void displayPixelValue(size_t x, size_t y, size_t z);
123  virtual void displayMagnifyView(size_t x, size_t y, size_t z);
124  virtual void drawImage();
125  virtual void overlayDataChanged(bool triggerEvents=true);
126  // ImageViewerWidget *qtViewer;
127  // ImageViewer *qtViewer;
128  virtual void dropEvent(QDropEvent *de);
129 
130 #ifdef USE_QWT
131  PlotWidget *histoPlot;
132  PlotWidget *profilePlot;
133 #endif // USE_QWT
134  };
135 
138 } // namespace smil
139 
140 
141 #endif // _D_QT_IMAGE_VIEWER_HPP
Qt image viewer.
Definition: DQtImageViewer.hpp:71
Definition: DColorConvert.h:38
virtual void setLookup(const map< UINT8, RGB > &lut)
Set the color table as a 8bits RGB map (keys between 0 and 255)
Definition: DQtImageViewer.hxx:308
Base image viewer.
Definition: DBaseImage.h:45
Definition: PlotWidget.h:42
Main Image class.
Definition: DQVtkViewer.hpp:44