fw4spl
SImageSlice.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_SIMAGESLICE_HPP__
8 #define __VISUVTKADAPTOR_SIMAGESLICE_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/Connection.hpp>
13 #include <fwCom/helper/SigSlotConnection.hpp>
14 
15 #include <fwData/Composite.hpp>
16 #include <fwData/Image.hpp>
17 
18 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
19 
20 #include <fwRenderVTK/IAdaptor.hpp>
21 
22 class vtkImageActor;
23 class vtkLookupTable;
24 class vtkImageMapToColors;
25 class vtkImageData;
26 class vtkPolyDataMapper;
27 class vtkPolyData;
28 class vtkActor;
29 
30 namespace visuVTKAdaptor
31 {
32 
67 class VISUVTKADAPTOR_CLASS_API SImageSlice : public ::fwDataTools::helper::MedicalImageAdaptor,
69 {
70 
71 public:
72 
74 
75  VISUVTKADAPTOR_API SImageSlice() noexcept;
76 
77  VISUVTKADAPTOR_API virtual ~SImageSlice() noexcept;
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 setInterpolation(bool interpolation)
94  {
95  m_interpolation = interpolation;
96  }
97 
98  //------------------------------------------------------------------------------
99 
100  void setActorOpacity(double actorOpacity)
101  {
102  m_actorOpacity = actorOpacity;
103  }
104 
105 protected:
106 
107  VISUVTKADAPTOR_API void configuring() override;
108  VISUVTKADAPTOR_API void starting() override;
109  VISUVTKADAPTOR_API void updating() override;
110  VISUVTKADAPTOR_API void stopping() override;
111 
121  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
122 
123  virtual void buildPipeline();
124  virtual void buildOutline();
125 
126  void setSlice( int slice, ::fwData::Image::sptr image );
127 
128  ::fwData::Image::sptr getCtrlImage();
129 
130  void updateOutline();
131  void updateImage( ::fwData::Image::sptr SImageSlice );
132  void updateSImageSliceIndex( ::fwData::Image::sptr SImageSlice );
133 
134  bool m_interpolation;
135  double m_actorOpacity;
136 
137  std::string m_imageSourceId;
138  vtkObject* m_imageSource;
139 
140  vtkImageActor* m_imageActor;
141 
142  vtkPolyData* m_planeOutlinePolyData;
143  vtkPolyDataMapper* m_planeOutlineMapper;
144  vtkActor* m_planeOutlineActor;
145 
146 private:
147 
153  void updateSliceIndex(int axial, int frontal, int sagittal);
155 
157  void updateSliceType(int from, int to);
162 };
163 
164 } //namespace visuVTKAdaptor
165 
166 #endif // __VISUVTKADAPTOR_SIMAGESLICE_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.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Adaptor to display only one slice of an image.
Definition: SImageSlice.hpp:67