fw4spl
SNegatoOneSlice.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_SNEGATOONESLICE_HPP__
8 #define __VISUVTKADAPTOR_SNEGATOONESLICE_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwData/Image.hpp>
13 
14 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
15 
16 #include <fwRenderVTK/IAdaptor.hpp>
17 
18 class vtkObject;
19 
20 namespace visuVTKAdaptor
21 {
22 
55 class VISUVTKADAPTOR_CLASS_API SNegatoOneSlice : public ::fwDataTools::helper::MedicalImageAdaptor,
57 {
58 
59 public:
60 
62 
63  VISUVTKADAPTOR_API SNegatoOneSlice() noexcept;
64 
65  VISUVTKADAPTOR_API virtual ~SNegatoOneSlice() noexcept;
66 
67  //------------------------------------------------------------------------------
68 
69  void setAllowAlphaInTF(bool allow)
70  {
71  m_allowAlphaInTF = allow;
72  }
73  //------------------------------------------------------------------------------
74 
75  void setInterpolation(bool interpolation)
76  {
77  m_interpolation = interpolation;
78  }
79  //------------------------------------------------------------------------------
80 
81  void setVtkImageSourceId(std::string id)
82  {
83  m_imageSourceId = id;
84  }
85  //------------------------------------------------------------------------------
86 
87  void setVtkImageSource(vtkObject* obj)
88  {
89  m_imageSource = obj;
90  }
91  //------------------------------------------------------------------------------
92 
93  void setActorOpacity(double actorOpacity)
94  {
95  m_actorOpacity = actorOpacity;
96  }
97 
98 protected:
99 
100  VISUVTKADAPTOR_API void configuring() override;
101  VISUVTKADAPTOR_API void starting() override;
102  VISUVTKADAPTOR_API void updating() override;
103  VISUVTKADAPTOR_API void stopping() override;
105  VISUVTKADAPTOR_API void swapping(const KeyType& key) override;
106 
115  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
116 
117  vtkObject* getImageSource();
118  void cleanImageSource();
119  ::fwRenderVTK::IAdaptor::sptr getImageSliceAdaptor();
120  ::fwRenderVTK::IAdaptor::sptr getImageAdaptor();
121 
122  bool m_manageImageSource;
123  std::string m_imageSourceId;
124  vtkObject* m_imageSource;
125 
126  bool m_allowAlphaInTF;
127  bool m_interpolation;
128  double m_actorOpacity;
129 
130  ::fwRenderVTK::IAdaptor::wptr m_imageAdaptor;
131  ::fwRenderVTK::IAdaptor::wptr m_imageSliceAdaptor;
132 
133 private:
138  void updateSliceType(int from, int to);
140 
142  void updateImage();
146 };
147 
148 } //namespace visuVTKAdaptor
149 
150 #endif // __VISUVTKADAPTOR_SNEGATOONESLICE_HPP__
This class is a helper to define the connections of a service and its data.
Definition: IService.hpp:454
Display a negato image with one slice.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.