fw4spl
SSlicesCursor.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_SSLICESCURSOR_HPP__
8 #define __VISUVTKADAPTOR_SSLICESCURSOR_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 vtkPolyData;
19 class vtkPolyDataMapper;
20 class vtkActor;
21 
22 namespace visuVTKAdaptor
23 {
24 
57 class VISUVTKADAPTOR_CLASS_API SSlicesCursor : public ::fwDataTools::helper::MedicalImageAdaptor,
59 {
60 
61 public:
63 
64  VISUVTKADAPTOR_API SSlicesCursor() noexcept;
65 
66  VISUVTKADAPTOR_API virtual ~SSlicesCursor() noexcept;
67 
72  static const ::fwCom::Slots::SlotKeyType s_UPDATE_SLICE_INDEX_SLOT;
73  static const ::fwCom::Slots::SlotKeyType s_UPDATE_SLICE_TYPE_SLOT;
74  static const ::fwCom::Slots::SlotKeyType s_UPDATE_IMAGE_SLOT;
75  static const ::fwCom::Slots::SlotKeyType s_SHOW_FULL_CROSS_SLOT;
76  static const ::fwCom::Slots::SlotKeyType s_SHOW_NORMAL_CROSS_SLOT;
77  static const ::fwCom::Slots::SlotKeyType s_SET_CROSS_SCALE_SLOT;
82 protected:
83 
84  VISUVTKADAPTOR_API void configuring() override;
85  VISUVTKADAPTOR_API void starting() override;
86  VISUVTKADAPTOR_API void updating() override;
87  VISUVTKADAPTOR_API void stopping() override;
88 
98  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
99 
101  void setCrossScale(double scale);
102 
103  void updateImageSliceIndex( ::fwData::Image::sptr image );
104  void buildPolyData();
105  void updateColors();
106  void buildColorAttribute();
107 
108  vtkPolyData* m_cursorPolyData;
109  vtkPolyDataMapper* m_cursorMapper;
110  vtkActor* m_cursorActor;
111  float m_scale;
112  bool m_isSelected;
113 
114 private:
115 
120  void updateSliceIndex(int axial, int frontal, int sagittal);
122 
124  void updateSliceType(int from, int to);
125 
127  void updateImage();
128 
130  void showFullCross();
131 
133  void showNormalCross();
138  static void barycenter( double ptA[3], double ptB[3], float scale, double result[3] );
140 
142  static void computeCrossPoints( double _ptA[3], double _ptB[3], double _ptP[3], double _scale, double _ptAprime[3],
143  double _ptBprime[3] );
144 
145 };
146 
147 } //namespace visuVTKAdaptor
148 
149 #endif // __VISUVTKADAPTOR_SSLICESCURSOR_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...
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Contains the representation of the data objects used in the framework.