fw4spl
SNegatoMPR.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_SNEGATOMPR_HPP__
8 #define __VISUVTKADAPTOR_SNEGATOMPR_HPP__
9 
10 #include "visuVTKAdaptor/config.hpp"
11 
12 #include <fwCom/helper/SigSlotConnection.hpp>
13 
14 #include <fwDataTools/helper/MedicalImageAdaptor.hpp>
15 
16 #include <fwRenderVTK/IAdaptor.hpp>
17 
18 #include <boost/logic/tribool.hpp>
19 
20 namespace visuVTKAdaptor
21 {
22 
23 class SliceCursor;
24 
64 class VISUVTKADAPTOR_CLASS_API SNegatoMPR : public ::fwDataTools::helper::MedicalImageAdaptor,
66 {
67 
68 public:
69 
71 
72  VISUVTKADAPTOR_API SNegatoMPR() noexcept;
73 
74  VISUVTKADAPTOR_API virtual ~SNegatoMPR() noexcept;
75 
76  static const ::fwServices::IService::KeyType s_IMAGE_INOUT;
77  static const ::fwServices::IService::KeyType s_TF_INOUT;
78 
79  typedef enum
80  {
81  NO_SLICE = 0,
82  ONE_SLICE,
83  THREE_SLICES
84  } SliceMode;
85 
86  //------------------------------------------------------------------------------
87 
88  void setAllowAlphaInTF(bool allow)
89  {
90  m_allowAlphaInTF = allow;
91  }
92  //------------------------------------------------------------------------------
93 
94  void setInterpolation(bool interpolation)
95  {
96  m_interpolation = interpolation;
97  }
98  //------------------------------------------------------------------------------
99 
100  void setVtkImageSourceId(std::string id)
101  {
102  m_imageSourceId = id;
103  }
104 
105  VISUVTKADAPTOR_API void setSliceMode(SliceMode sliceMode);
106  VISUVTKADAPTOR_API SliceMode getSliceMode() const;
107  VISUVTKADAPTOR_API ::boost::logic::tribool is3dModeEnabled() const;
108  VISUVTKADAPTOR_API void set3dMode( bool enabled );
109 
111  void setActorOpacity(double actorOpacity)
112  {
113  m_actorOpacity = actorOpacity;
114  }
115 
116 protected:
117 
118  VISUVTKADAPTOR_API void configuring() override;
119  VISUVTKADAPTOR_API void starting() override;
120  VISUVTKADAPTOR_API void updating() override;
121  VISUVTKADAPTOR_API void stopping() override;
122  VISUVTKADAPTOR_API void swapping(const KeyType& key) override;
123 
131  VISUVTKADAPTOR_API virtual KeyConnectionsMap getAutoConnections() const override;
132 
133  ::fwRenderVTK::IAdaptor::sptr addAdaptor(const std::string& adaptor, int axis = -1);
134 
135 private:
136 
141  void updateSliceType(int from, int to);
143 
145  void updateSliceMode(int mode);
146 
148  void showSlice(bool isShown);
149 
151  void setCrossScale(double scale);
152 
154  void changeImageSource(std::string _value, std::string _key);
155 
160  bool m_allowAlphaInTF;
161  bool m_interpolation;
162  double m_actorOpacity;
163 
164  std::string m_imageSourceId;
165 
166  std::string m_slicingStartingProxy;
167  std::string m_slicingStoppingProxy;
168 
169  ::boost::logic::tribool m_3dModeEnabled;
170  SliceMode m_sliceMode;
171  SliceMode m_backupedSliceMode;
172  ::fwCom::helper::SigSlotConnection m_connections;
173 
174  ::fwRenderVTK::IAdaptor::wptr m_sliceCursor;
175 };
176 
177 } //namespace visuVTKAdaptor
178 
179 #endif // __VISUVTKADAPTOR_SNEGATOMPR_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...
void setActorOpacity(double actorOpacity)
Set actor opacity.
Definition: SNegatoMPR.hpp:111
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
This class provides few tools to ease connect/disconnect between a signal emitter and a slot receiver...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
Display a negato image.
Definition: SNegatoMPR.hpp:64