IGSTK
igstkImageSpatialObjectRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkImageSpatialObjectRepresentation.h,v $
5  Language: C++
6  Date: $Date: 2008-11-17 20:12:25 $
7  Version: $Revision: 1.22 $
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 #ifndef __igstkImageSpatialObjectRepresentation_h
18 #define __igstkImageSpatialObjectRepresentation_h
19 
20 #include "igstkMacros.h"
23 #include "igstkStateMachine.h"
24 
25 #include "vtkImageActor.h"
26 #include "vtkLookupTable.h"
27 #include "vtkImageMapToColors.h"
28 
29 namespace igstk
30 {
31 
32 
50 template < class TImageSpatialObject >
52 {
53 
54 public:
55 
59 
60 public:
61 
62  typedef TImageSpatialObject ImageSpatialObjectType;
63 
64  typedef typename ImageSpatialObjectType::ConstPointer
66 
68  Pointer Copy() const;
69 
72  typedef enum
73  {
77  }
79 
81  void RequestSetImageSpatialObject( const ImageSpatialObjectType *
83 
85  typedef unsigned int SliceNumberType;
86 
89 
91  void RequestSetOrientation( OrientationType orientation );
92 
94  void SetWindowLevel( double window, double level );
95 
97  void SetOpacity(float alpha);
98 
100  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
101 
105 
106 protected:
107 
110 
113 
115  void DeleteActors();
116 
118  void CreateActors();
119 
123  igstkObserverMacro( VTKImage, VTKImageModifiedEvent,
125  igstkObserverMacro( ImageTransform, CoordinateSystemTransformToEvent,
127 
128 
129 private:
130 
131  ImageSpatialObjectRepresentation(const Self&); //purposely not implemented
132  void operator=(const Self&); //purposely not implemented
133 
135  ImageSpatialObjectConstPointer m_ImageSpatialObject;
136  ImageSpatialObjectConstPointer m_ImageSpatialObjectToAdd;
137 
139  vtkImageData * m_ImageData;
140  vtkImageActor * m_ImageActor;
141  vtkLookupTable * m_LUT;
142  vtkImageMapToColors * m_MapColors;
143 
145  double m_Level;
146  double m_Window;
147 
149  virtual void UpdateRepresentationProcessing();
150 
152  void NoProcessing();
153 
156  void SetImageSpatialObjectProcessing();
157 
160  void SetImage( const vtkImageData * image );
161 
163  void AttemptSetSliceNumberProcessing();
164 
166  void SetSliceNumberProcessing();
167 
169  void SetOrientationProcessing();
170 
173  void ReportSliceNumberBoundsProcessing();
174 
176  void ConnectVTKPipelineProcessing();
177 
178 private:
179 
181  igstkDeclareInputMacro( ValidImageSpatialObject );
182  igstkDeclareInputMacro( NullImageSpatialObject );
183  igstkDeclareInputMacro( EmptyImageSpatialObject );
184  igstkDeclareInputMacro( SetSliceNumber );
185  igstkDeclareInputMacro( ValidSliceNumber );
186  igstkDeclareInputMacro( InvalidSliceNumber );
187  igstkDeclareInputMacro( ValidOrientation );
188  igstkDeclareInputMacro( RequestSliceNumberBounds );
189  igstkDeclareInputMacro( ConnectVTKPipeline );
190 
192  igstkDeclareStateMacro( NullImageSpatialObject );
193  igstkDeclareStateMacro( ValidImageSpatialObject );
194  igstkDeclareStateMacro( ValidImageOrientation );
195  igstkDeclareStateMacro( ValidSliceNumber );
196  igstkDeclareStateMacro( AttemptingToSetSliceNumber );
197 
199  SliceNumberType m_SliceNumberToBeSet;
200  SliceNumberType m_SliceNumber;
201 
203  OrientationType m_OrientationToBeSet;
204  OrientationType m_Orientation;
205 
207  typename VTKImageObserver::Pointer m_VTKImageObserver;
208  typename ImageTransformObserver::Pointer m_ImageTransformObserver;
209 
212  Transform m_ImageTransform;
213 };
214 
215 } // end namespace igstk
216 
217 #ifndef IGSTK_MANUAL_INSTANTIATION
218 #include "igstkImageSpatialObjectRepresentation.txx"
219 #endif
220 
221 
222 #endif // __igstkImageSpatialObjectRepresentation_h