~ubuntu-branches/ubuntu/lucid/igstk/lucid

« back to all changes in this revision

Viewing changes to Source/igstkToolProjectionObjectRepresentation.h

  • Committer: Bazaar Package Importer
  • Author(s): Dominique Belhachemi
  • Date: 2009-10-07 17:35:43 UTC
  • mfrom: (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091007173543-69eyhyjrh0bfoqe5
Tags: 4.2.0-2
* Fixed link issue (Closes: #549799)
* switch to quilt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   Image Guided Surgery Software Toolkit
 
4
  Module:    $RCSfile: igstkToolProjectionObjectRepresentation.h,v $
 
5
  Language:  C++
 
6
  Date:      $Date: 2009-06-15 21:05:54 $
 
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 __igstkToolProjectionObjectRepresentation_h
 
19
#define __igstkToolProjectionObjectRepresentation_h
 
20
 
 
21
#include "igstkMacros.h"
 
22
#include "igstkObjectRepresentation.h"
 
23
#include "igstkToolProjectionSpatialObject.h"
 
24
#include "igstkReslicerPlaneSpatialObject.h"
 
25
#include "igstkStateMachine.h"
 
26
 
 
27
class vtkLineSource;
 
28
class vtkProperty;
 
29
 
 
30
namespace igstk
 
31
{
 
32
 
 
33
/** \class ToolProjectionObjectRepresentation
 
34
 * 
 
35
 * \brief This class provides a visual representation of a ToolProjectionObject.
 
36
 *
 
37
 * This class displays the projection of a tool spatial object on top of a 
 
38
 * reslicing plane.
 
39
 *
 
40
 * \sa ToolProjectionObject
 
41
 *
 
42
 * \ingroup ObjectRepresentation
 
43
 */
 
44
 
 
45
class ToolProjectionObjectRepresentation : public ObjectRepresentation
 
46
{
 
47
 
 
48
public:
 
49
 
 
50
  /** Macro with standard traits declarations. */
 
51
  igstkStandardClassTraitsMacro( ToolProjectionObjectRepresentation, 
 
52
                                 ObjectRepresentation )
 
53
 
 
54
public:
 
55
 
 
56
  /** Typedefs */ 
 
57
 
 
58
  typedef ReslicerPlaneSpatialObject                   ReslicerPlaneType;
 
59
 
 
60
  typedef ReslicerPlaneType::Pointer            ReslicerPlanePointerType;  
 
61
 
 
62
  typedef ReslicerPlaneType::VectorType                       VectorType;
 
63
 
 
64
  typedef ToolProjectionSpatialObject    ToolProjectionSpatialObjectType;
 
65
 
 
66
  /** Provides the reslicing plane onto which the tool is projected */
 
67
  void RequestSetReslicePlaneSpatialObject( const ReslicerPlaneType *
 
68
                                                            planeSpatialObject);
 
69
 
 
70
  /** Return a copy of the current object representation */
 
71
  Pointer Copy() const;
 
72
 
 
73
  /** Connect this representation class to the spatial object */
 
74
  void RequestSetToolProjectionObject( const ToolProjectionSpatialObjectType * 
 
75
                                                         toolProjectionObject );
 
76
 
 
77
  virtual void SetVisibility ( bool visible);
 
78
 
 
79
  /** Set/Get line width */
 
80
  void SetLineWidth(double LineWidth);
 
81
  igstkGetMacro( LineWidth, double );
 
82
 
 
83
protected:
 
84
 
 
85
  ToolProjectionObjectRepresentation( void );
 
86
  virtual ~ToolProjectionObjectRepresentation( void );
 
87
 
 
88
  /** Print object information */
 
89
  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 
 
90
 
 
91
  /** Create the VTK actors */
 
92
  void CreateActors();
 
93
 
 
94
  /** Verify time stamp. Use the reslicing tool transform to verify 
 
95
  * the time stamp */
 
96
  virtual bool VerifyTimeStamp() const;
 
97
 
 
98
private:
 
99
 
 
100
  ToolProjectionObjectRepresentation(const Self&); //purposely not implemented
 
101
  void operator=(const Self&);     //purposely not implemented
 
102
 
 
103
  
 
104
  /** Internal itkSpatialObject */
 
105
  ToolProjectionSpatialObjectType::ConstPointer   m_ToolProjectionSpatialObject;
 
106
 
 
107
  /** update the visual representation with changes in the geometry */
 
108
  virtual void UpdateRepresentationProcessing();
 
109
 
 
110
  /** Connect this representation class to the spatial object. Only to be
 
111
   * called by the State Machine. */
 
112
  void SetToolProjectionObjectProcessing();
 
113
 
 
114
  /** Method for performing a null operation during a State Machine 
 
115
   *  transition */
 
116
  void NoProcessing();
 
117
 
 
118
  /** Set the reslice plane spatial object */
 
119
  void SetReslicePlaneSpatialObjectProcessing();
 
120
 
 
121
  /** Define observers for event communication */
 
122
  igstkObserverMacro( ImageBounds, igstk::ImageBoundsEvent, 
 
123
                                  igstk::EventHelperType::ImageBoundsType );
 
124
 
 
125
  /** Declare the observer that will receive the reslice plane normal from the
 
126
  * ReslicerPlaneSpatialObject */
 
127
  igstkObserverMacro( ReslicerPlaneNormal, 
 
128
                                    ReslicerPlaneType::ReslicerPlaneNormalEvent,
 
129
                                                 ReslicerPlaneType::VectorType);
 
130
 
 
131
  ReslicerPlaneNormalObserver::Pointer  m_ReslicerPlaneNormalObserver;
 
132
 
 
133
private:
 
134
 
 
135
  /** Variables for managing reslice plane spatial object */
 
136
  ReslicerPlanePointerType  m_ReslicePlaneSpatialObjectToBeSet;
 
137
  ReslicerPlanePointerType  m_ReslicePlaneSpatialObject;
 
138
 
 
139
  vtkLineSource* m_LineSource;  
 
140
  vtkProperty*   m_LineProperty;
 
141
 
 
142
  double m_LineWidth;
 
143
 
 
144
  /** Inputs to the State Machine */
 
145
  igstkDeclareInputMacro( ValidToolProjectionObject );
 
146
  igstkDeclareInputMacro( NullToolProjectionObject );
 
147
  igstkDeclareInputMacro( ValidReslicePlaneSpatialObject );
 
148
  igstkDeclareInputMacro( InValidReslicePlaneSpatialObject );
 
149
  
 
150
  /** States for the State Machine */
 
151
  igstkDeclareStateMacro( NullToolProjectionObject );
 
152
  igstkDeclareStateMacro( ValidToolProjectionObject );
 
153
  igstkDeclareStateMacro( ValidReslicePlaneSpatialObject );
 
154
 
 
155
  ToolProjectionSpatialObjectType::ConstPointer m_ToolProjectionObjectToAdd;
 
156
 
 
157
};
 
158
 
 
159
} // end namespace igstk
 
160
 
 
161
#endif // __igstkToolProjectionObjectRepresentation_h