fw4spl
SImage3DCursor.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_SIMAGE3DCURSOR_HPP__
8 #define __VISUVTKADAPTOR_SIMAGE3DCURSOR_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwData/Color.hpp>
13 
14 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
15 
16 #include <fwRenderVTK/IAdaptor.hpp>
17 
18 #include <vtkSmartPointer.h>
19 
20 class vtkActor;
21 class vtkPolyData;
22 class vtkPolyDataMapper;
23 
24 namespace visuVTKAdaptor
25 {
26 
48 class VISUVTKADAPTOR_CLASS_API SImage3DCursor : public ::fwDataTools::helper::MedicalImageAdaptor,
50 {
51 
52 public:
54 
55  VISUVTKADAPTOR_API SImage3DCursor() noexcept;
56 
57  VISUVTKADAPTOR_API virtual ~SImage3DCursor() noexcept;
58 
59  VISUVTKADAPTOR_API void updateCursorPosition( double world[3] );
60 
61  VISUVTKADAPTOR_API void setVisibility( bool visibility );
62 
69  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
70 
71 protected:
72 
73  VISUVTKADAPTOR_API virtual void configuring() override;
74  VISUVTKADAPTOR_API virtual void starting() override;
75  VISUVTKADAPTOR_API virtual void stopping() override;
76  VISUVTKADAPTOR_API virtual void swapping() override;
77  VISUVTKADAPTOR_API virtual void updating() override;
78 
79  void buildPolyData(float radius = 1.0);
80 
81  vtkSmartPointer<vtkActor> m_cursorActor;
82  vtkSmartPointer<vtkPolyData> m_cursorPolyData;
83  vtkSmartPointer<vtkPolyDataMapper> m_cursorMapper;
84 
85 private:
86 
91  void updateSliceIndex(int axial, int frontal, int sagittal);
93 
95  void updateSphere(::fwData::Color::sptr color, float radius);
100 };
101 
102 } //namespace visuVTKAdaptor
103 
104 #endif // __VISUVTKADAPTOR_SIMAGE3DCURSOR_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...
Add a 3D spatial marker represented by a sphere that identify the intersection point of the selected ...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Contains the representation of the data objects used in the framework.