fw4spl
SProbeCursor.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_SPROBECURSOR_HPP__
8 #define __VISUVTKADAPTOR_SPROBECURSOR_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwData/TransferFunction.hpp>
13 
14 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
15 
16 #include <fwRenderVTK/IAdaptor.hpp>
17 
18 class vtkCommand;
19 class vtkActor;
20 class vtkActor2D;
21 class vtkTextMapper;
22 class vtkPolyData;
23 class vtkPolyDataMapper;
24 
25 namespace visuVTKAdaptor
26 {
27 
53 class VISUVTKADAPTOR_CLASS_API SProbeCursor : public ::fwDataTools::helper::MedicalImageAdaptor,
55 {
56 
57 public:
59 
60  static const ::fwCom::Slots::SlotKeyType s_UPDATE_SLICE_INDEX_SLOT;
61 
62  VISUVTKADAPTOR_API SProbeCursor() noexcept;
63 
64  VISUVTKADAPTOR_API virtual ~SProbeCursor() noexcept;
65 
66  VISUVTKADAPTOR_API virtual void updateView( double world[3] );
67 
68  VISUVTKADAPTOR_API void setVisibility( bool visibility );
69 
70  VISUVTKADAPTOR_API void startSProbeCursor();
71 
72 protected:
73 
74  VISUVTKADAPTOR_API void configuring() override;
75  VISUVTKADAPTOR_API void starting() override;
76  VISUVTKADAPTOR_API void updating() override;
77  VISUVTKADAPTOR_API void stopping() override;
78 
87  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
88 
89  void buildTextActor();
90  void buildPolyData();
91 
92  void computeCrossExtremity(fwData::Image::csptr image, const int probeSlice[3], double worldCross[4][3] );
93 
94  float m_priority;
95 
96  vtkCommand* m_vtkObserver;
97 
98  vtkActor2D* m_textActor; // rendering defect using a vtkTextActor
99  vtkTextMapper* m_textMapper;
100 
101  vtkPolyData* m_cursorPolyData;
102  vtkPolyDataMapper* m_cursorMapper;
103  vtkActor* m_cursorActor;
104 
105 private:
110  void updateSliceIndex(int axial, int frontal, int sagittal);
116 };
117 
118 } //namespace visuVTKAdaptor
119 
120 #endif // __VISUVTKADAPTOR_SPROBECURSOR_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...
Cursor management: displays a red cross representing the image picked point.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Contains the representation of the data objects used in the framework.