IGSTK
igstkReslicerPlaneSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkReslicerPlaneSpatialObject.h,v $
5  Language: C++
6  Date: $Date: 2009-06-15 21:35:41 $
7  Version: $Revision: 1.2 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkReslicerPlaneSpatialObject_h
19 #define __igstkReslicerPlaneSpatialObject_h
20 
21 #include "igstkMacros.h"
22 #include "igstkTransform.h"
23 #include "igstkSpatialObject.h"
24 #include "igstkStateMachine.h"
25 
26 
27 namespace igstk
28 {
29 
64 {
65 
66 public:
67 
70 
71 public:
72 
74  typedef SpatialObject BoundingBoxProviderSpatialObjectType;
75  typedef BoundingBoxProviderSpatialObjectType::ConstPointer
77 
79  typedef ToolSpatialObjectType::Pointer ToolSpatialObjectPointer;
80 
81  typedef igstk::Transform::VectorType VectorType;
82  typedef igstk::Transform::VersorType VersorType;
83 
84  igstkLoadedEventMacro( ToolTipPositionEvent, IGSTKEvent, VectorType );
85  igstkLoadedEventMacro( ReslicerPlaneNormalEvent, IGSTKEvent, VectorType );
86  igstkLoadedEventMacro( ReslicerPlaneCenterEvent, IGSTKEvent, VectorType );
87 
90  {
94  };
95 
98  {
108  };
109 
111  void RequestSetReslicingMode( ReslicingMode reslicingMode );
112 
114  void RequestSetOrientationType( OrientationType orientationType );
115 
118  BoundingBoxProviderSpatialObjectType * boundingBoxProviderSpatialObject );
119 
125  toolSpatialObject );
126 
128  void RequestSetCursorPosition( const double *point);
129 
131  void RequestGetToolPosition();
132 
135 
138 
141 
144 
148 
151 
153  VectorType GetToolPosition() const;
154 
156  bool IsToolSpatialObjectSet();
157 
160 
161 protected:
162 
165 
168 
170  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
171 
172 private:
173  ReslicerPlaneSpatialObject(const Self&); //purposely not implemented
174  void operator=(const Self&); //purposely not implemented
175 
177  igstkDeclareInputMacro( SetBoundingBoxProviderSpatialObject );
178  igstkDeclareInputMacro( ValidReslicingMode );
179  igstkDeclareInputMacro( InValidReslicingMode );
180  igstkDeclareInputMacro( ValidOrientationType );
181  igstkDeclareInputMacro( InValidOrientationType );
182  igstkDeclareInputMacro( ValidBoundingBoxProviderSpatialObject );
183  igstkDeclareInputMacro( InValidBoundingBoxProviderSpatialObject );
184  igstkDeclareInputMacro( ValidToolSpatialObject );
185  igstkDeclareInputMacro( InValidToolSpatialObject );
186  igstkDeclareInputMacro( SetCursorPosition );
187  igstkDeclareInputMacro( ValidCursorPosition );
188  igstkDeclareInputMacro( InValidCursorPosition );
189  igstkDeclareInputMacro( GetToolPosition );
190  igstkDeclareInputMacro( GetReslicingPlaneParameters );
191  igstkDeclareInputMacro( GetToolTransformWRTImageCoordinateSystem );
192  igstkDeclareInputMacro( ToolTransformWRTImageCoordinateSystem );
193  igstkDeclareInputMacro( ComputeReslicePlane );
194 
196  igstkDeclareStateMacro( Initial );
197  igstkDeclareStateMacro( ReslicingModeSet );
198  igstkDeclareStateMacro( OrientationTypeSet );
199  igstkDeclareStateMacro( BoundingBoxProviderSpatialObjectSet );
200  igstkDeclareStateMacro( AttemptingToSetCursorPosition );
201  igstkDeclareStateMacro( AttemptingToSetBoundingBoxProviderSpatialObject );
202  igstkDeclareStateMacro( AttemptingToGetToolTransformWRTImageCoordinateSystem);
203 
205  void NoProcessing();
206 
208  void SetOrientationTypeProcessing( void );
209 
211  void SetReslicingModeProcessing( void );
212 
214  void AttemptSetBoundingBoxProviderSpatialObjectProcessing();
215 
217  void AttemptSetCursorPositionProcessing( void );
218  void SetCursorPositionProcessing( void );
219 
221  void ComputeReslicePlaneProcessing();
222 
224  void SetBoundingBoxProviderSpatialObjectProcessing( void );
225 
227  void SetToolSpatialObjectProcessing( void );
228 
230  void ReportInvalidReslicingModeProcessing( void );
231 
233  void ReportInvalidOrientationTypeProcessing( void );
234 
236  void ReportInvalidBoundingBoxProviderSpatialObjectProcessing( void );
237 
239  void ReportInvalidToolSpatialObjectProcessing( void );
240 
242  void ReportInvalidCursorPositionProcessing( void );
243 
245  void ReportInvalidRequestProcessing( void );
246 
249  void RequestGetToolTransformWRTImageCoordinateSystemProcessing( void );
250 
253  void ReceiveToolTransformWRTImageCoordinateSystemProcessing( void );
254 
256  void ReportToolPositionProcessing( void );
257 
259  void ReportReslicingPlaneParametersProcessing( void );
260 
262  void ComputeOrthogonalReslicingPlane();
263  void ComputeObliqueReslicingPlane();
264  void ComputeOffOrthogonalReslicingPlane();
265 
267  ReslicingMode m_ReslicingModeToBeSet;
268  ReslicingMode m_ReslicingMode;
269 
271  OrientationType m_OrientationTypeToBeSet;
272  OrientationType m_OrientationType;
273 
276  m_BoundingBoxProviderSpatialObjectToBeSet;
278  m_BoundingBoxProviderSpatialObject;
279 
281  ToolSpatialObjectPointer m_ToolSpatialObjectToBeSet;
282  ToolSpatialObjectPointer m_ToolSpatialObject;
283 
285  VectorType m_PlaneNormal;
286  VectorType m_PlaneCenter;
287 
288  // Event macro setup to receive the tool spatial object transform
289  // with respect to the reference spatial object coordinate system
290  igstkLoadedEventTransductionMacro( CoordinateSystemTransformTo,
291  ToolTransformWRTImageCoordinateSystem );
292 
293 
294  // Tool transform with respect to the reference spatial object
295  // coordinate system
296  igstk::Transform m_ToolTransformWRTImageCoordinateSystem;
297 
299  igstkObserverObjectMacro( BoundingBox, SpatialObject::BoundingBoxEvent,
301 
303  double m_CursorPositionToBeSet[3];
304  double m_CursorPosition[3];
305  bool m_CursorPositionSetFlag;
306 
307  VectorType m_ToolPosition;
308 
309  double m_Bounds[6];
310 
311  BoundingBoxType::Pointer m_BoundingBox;
312 
314  bool m_ToolSpatialObjectSet;
315 
316 };
317 
318 } // end namespace igstk
319 
320 #endif // __igstkReslicerPlaneSpatialObject_h