ddt  0.1
ddtCPLImageGraphicsItem.hpp
Go to the documentation of this file.
1 // @copyright
2 // (c) Copyright ESO 2020
3 // All Rights Reserved
4 // ESO (eso.org) is an Intergovernmental Organization, and therefore special
5 // legal conditions apply.
6 //
7 // @file ddtCPLImageGraphicsItem.hpp
8 // @brief DDT Widgets. Class for CPL Image Graphics Items.
9 //
10 // Class derived from QGraphicsItem. Allows to render a CPL image as a
11 // QGraphicsItem.
12 //
13 // @author Carsten Mannel, CGI
14 // @since 2020/02/28
15 //
16 
17 #ifndef DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
18 #define DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
19 
21 #include "ddt/imageColor.hpp"
22 
23 #include <cpl.h>
24 
29  public:
38  explicit DdtCPLImageGraphicsItem(cpl_image* const in_image);
39 
46  DdtCPLImageGraphicsItem(cpl_image* const in_image,
47  ddt::colorMap_t* const color_map,
48  ddt::scalingLut_t* scaling_lut);
49 
57  DdtCPLImageGraphicsItem(cpl_image* const in_image,
58  ddt::colorMapARGB_t* const color_map,
59  ddt::scalingLut_t* scaling_lut);
60 
64  virtual ~DdtCPLImageGraphicsItem();
65 
70  QRectF boundingRect() const;
77  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
78  QWidget* widget);
79 
84  virtual QImage* GetImage();
85 
91  enum { ITEM_TYPE = 66036 };
92 
97  int type() const;
98 
99  protected:
103  cpl_image* cimage;
107  QImage* qimage;
108 
109  private:
110  int width;
111  int height;
112 
116  void Init();
117 
122  void loadImageGrayColor(cpl_image* const in_image);
123 
129  void loadImageGrayColorInt(cpl_image* const in_image);
130 
136  void loadImageGrayColorFloat(cpl_image* const in_image);
137 
143  void loadImageGrayColorDouble(cpl_image* const in_image);
144 
151  void loadImageColor(const cpl_image* const in_image,
152  ddt::colorMap_t* color_map,
153  ddt::scalingLut_t* scaling_lut);
154 
161  void loadImageColor(const cpl_image* const in_image,
162  ddt::colorMapARGB_t* const color_map,
163  ddt::scalingLut_t* const scaling_lut);
164 
172  void loadImageColorInt(cpl_image* const in_image,
173  ddt::colorMap_t* const color_map,
174  ddt::scalingLut_t* const scaling_lut);
175 
183  void loadImageColorInt(cpl_image* const in_image,
184  ddt::colorMapARGB_t* const color_map,
185  ddt::scalingLut_t* const scaling_lut);
186 
194  void loadImageColorFloat(cpl_image* const in_image,
195  ddt::colorMap_t* const color_map,
196  ddt::scalingLut_t* const scaling_lut);
197 
205  void loadImageColorFloat(cpl_image* const in_image,
206  ddt::colorMapARGB_t* const color_map,
207  ddt::scalingLut_t* const scaling_lut);
208 
216  void loadImageColorDouble(cpl_image* const in_image,
217  ddt::colorMap_t* const color_map,
218  ddt::scalingLut_t* const scaling_lut);
219 
227  void loadImageColorDouble(cpl_image* const in_image,
228  ddt::colorMapARGB_t* const color_map,
229  ddt::scalingLut_t* const scaling_lut);
230 
234  std::vector<unsigned int> getRgbVectorGray() const;
235 
239  std::vector<unsigned int> getRgbVectorColor(
240  ddt::colorMap_t* const color_map) const;
241 
246  void createImageAndPixvalRange(const cpl_image* const in_image,
247  double* const min_pixval,
248  double* const pixval_range);
249 
254  void createImageAndScalingFactors(const cpl_image* const in_image,
255  const ddt::scalingLut_t* const scaling_lut,
256  double* const offset, double* const factor);
257 
261  void createImage(const cpl_image* const in_image);
262 };
263 
264 #endif // DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
ddt::scalingLut_t
Definition: imageColor.hpp:76
DdtCPLImageGraphicsItem::~DdtCPLImageGraphicsItem
virtual ~DdtCPLImageGraphicsItem()
Definition: ddtCPLImageGraphicsItem.cpp:74
DdtCPLImageGraphicsItem
Definition: ddtCPLImageGraphicsItem.hpp:28
DdtImageGraphicsItem
Definition: ddtImageGraphicsItem.hpp:25
ddt::colorMapARGB_t
std::array< unsigned int, MAX_COLOR_MAP_ENTRIES > colorMapARGB_t
Definition: imageColor.hpp:66
DdtCPLImageGraphicsItem::qimage
QImage * qimage
Definition: ddtCPLImageGraphicsItem.hpp:107
DdtCPLImageGraphicsItem::GetImage
virtual QImage * GetImage()
Definition: ddtCPLImageGraphicsItem.cpp:100
imageColor.hpp
DdtCPLImageGraphicsItem::boundingRect
QRectF boundingRect() const
Definition: ddtCPLImageGraphicsItem.cpp:82
DdtCPLImageGraphicsItem::DdtCPLImageGraphicsItem
DdtCPLImageGraphicsItem()
Definition: ddtCPLImageGraphicsItem.cpp:27
ddtImageGraphicsItem.hpp
DdtCPLImageGraphicsItem::type
int type() const
Definition: ddtCPLImageGraphicsItem.cpp:87
DdtCPLImageGraphicsItem::cimage
cpl_image * cimage
Definition: ddtCPLImageGraphicsItem.hpp:103
DdtCPLImageGraphicsItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: ddtCPLImageGraphicsItem.cpp:92
ddt::colorMap_t
std::array< std::array< float, COLOR_MAP_ENTRY_SIZE >, MAX_COLOR_MAP_ENTRIES > colorMap_t
Definition: imageColor.hpp:56
DdtCPLImageGraphicsItem::ITEM_TYPE
@ ITEM_TYPE
Definition: ddtCPLImageGraphicsItem.hpp:91