fw4spl
SImagesBlend.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __VISUVTKADAPTOR_SIMAGESBLEND_HPP__
8 #define __VISUVTKADAPTOR_SIMAGESBLEND_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/helper/SigSlotConnection.hpp>
13 
14 #include <fwData/Image.hpp>
15 
16 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
17 
18 #include <fwRenderVTK/IAdaptor.hpp>
19 
20 class vtkImageActor;
21 class vtkLookupTable;
22 class vtkImageMapToColors;
23 class vtkImageData;
24 class vtkPolyDataMapper;
25 class vtkPolyData;
26 class vtkActor;
27 class vtkImageCheckerboard;
28 class vtkThreadedImageAlgorithm;
29 
30 namespace visuVTKAdaptor
31 {
32 
72 class VISUVTKADAPTOR_CLASS_API SImagesBlend : public ::fwRenderVTK::IAdaptor
73 {
74 
75 public:
76 
78 
79  VISUVTKADAPTOR_API SImagesBlend() noexcept;
80 
81  VISUVTKADAPTOR_API virtual ~SImagesBlend() noexcept;
82 
83  //------------------------------------------------------------------------------
84 
85  void setVtkImageRegisterId(const std::string& id)
86  {
87  m_imageRegisterId = id;
88  }
89 
90 protected:
91 
92  class ImageInfo
93  {
94 
95  public:
96  ImageInfo() :
97  m_useTFAlfa(false),
98  m_imageOpacity(1.0)
99  {
100  }
101 
102  bool m_useTFAlfa;
103  double m_imageOpacity;
104  };
105 
106  VISUVTKADAPTOR_API void configuring() override;
107  VISUVTKADAPTOR_API void starting() override;
108  VISUVTKADAPTOR_API void updating() override;
109  VISUVTKADAPTOR_API void stopping() override;
110  VISUVTKADAPTOR_API void swapping(const KeyType& key) override;
111 
119  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
120 
121  void addImageAdaptors();
122  void removeImageAdaptors();
123 
125  // false
126  bool checkImageInformations();
127 
128 private:
129 
131  void changeMode(std::string _value, std::string _key);
132 
134  void changeCheckerboardDivision(int division);
135 
137  void addImage(::fwData::Image::sptr img, ::fwData::TransferFunction::sptr tf, const ImageInfo& info);
138 
140  void setTopImageTransparency(int transparency);
141 
142  typedef std::vector< ImageInfo > ImageInfoMap;
144  ImageInfoMap m_imagesInfo;
145 
147  vtkThreadedImageAlgorithm* m_imageAlgorithm;
148 
149  std::string m_imageRegisterId;
150 
152  int m_checkerboardDivision;
153 
155  int m_zDivision;
156 };
157 
158 } //namespace visuVTKAdaptor
159 
160 #endif // __VISUVTKADAPTOR_SIMAGESBLEND_HPP__
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
STL namespace.
Manage blend for image given in configuration.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.