IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkImageSpatialObjectRepresentation.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-11-17 20:12:25 $ 00007 Version: $Revision: 1.22 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __igstkImageSpatialObjectRepresentation_h 00018 #define __igstkImageSpatialObjectRepresentation_h 00019 00020 #include "igstkMacros.h" 00021 #include "igstkObjectRepresentation.h" 00022 #include "igstkImageSpatialObject.h" 00023 #include "igstkStateMachine.h" 00024 00025 #include "vtkImageActor.h" 00026 #include "vtkLookupTable.h" 00027 #include "vtkImageMapToColors.h" 00028 00029 namespace igstk 00030 { 00031 00032 00050 template < class TImageSpatialObject > 00051 class ImageSpatialObjectRepresentation : public ObjectRepresentation 00052 { 00053 00054 public: 00055 00057 igstkStandardTemplatedClassTraitsMacro( ImageSpatialObjectRepresentation, \ 00058 ObjectRepresentation ) 00059 00060 public: 00061 00062 typedef TImageSpatialObject ImageSpatialObjectType; 00063 00064 typedef typename ImageSpatialObjectType::ConstPointer 00065 ImageSpatialObjectConstPointer; 00066 00068 Pointer Copy() const; 00069 00072 typedef enum 00073 { 00074 Sagittal, 00075 Coronal, 00076 Axial 00077 } 00078 OrientationType; 00079 00081 void RequestSetImageSpatialObject( const ImageSpatialObjectType * 00082 ImageSpatialObject ); 00083 00085 typedef unsigned int SliceNumberType; 00086 00088 void RequestSetSliceNumber( SliceNumberType slice ); 00089 00091 void RequestSetOrientation( OrientationType orientation ); 00092 00094 void SetWindowLevel( double window, double level ); 00095 00097 void SetOpacity(float alpha); 00098 00100 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00101 00104 void RequestGetSliceNumberBounds(); 00105 00106 protected: 00107 00109 ImageSpatialObjectRepresentation(); 00110 00112 ~ImageSpatialObjectRepresentation(); 00113 00115 void DeleteActors(); 00116 00118 void CreateActors(); 00119 00123 igstkObserverMacro( VTKImage, VTKImageModifiedEvent, 00124 EventHelperType::VTKImagePointerType ); 00125 igstkObserverMacro( ImageTransform, CoordinateSystemTransformToEvent, 00126 CoordinateSystemTransformToResult ); 00127 00128 00129 private: 00130 00131 ImageSpatialObjectRepresentation(const Self&); //purposely not implemented 00132 void operator=(const Self&); //purposely not implemented 00133 00135 ImageSpatialObjectConstPointer m_ImageSpatialObject; 00136 ImageSpatialObjectConstPointer m_ImageSpatialObjectToAdd; 00137 00139 vtkImageData * m_ImageData; 00140 vtkImageActor * m_ImageActor; 00141 vtkLookupTable * m_LUT; 00142 vtkImageMapToColors * m_MapColors; 00143 00145 double m_Level; 00146 double m_Window; 00147 00149 virtual void UpdateRepresentationProcessing(); 00150 00152 void NoProcessing(); 00153 00156 void SetImageSpatialObjectProcessing(); 00157 00160 void SetImage( const vtkImageData * image ); 00161 00163 void AttemptSetSliceNumberProcessing(); 00164 00166 void SetSliceNumberProcessing(); 00167 00169 void SetOrientationProcessing(); 00170 00173 void ReportSliceNumberBoundsProcessing(); 00174 00176 void ConnectVTKPipelineProcessing(); 00177 00178 private: 00179 00181 igstkDeclareInputMacro( ValidImageSpatialObject ); 00182 igstkDeclareInputMacro( NullImageSpatialObject ); 00183 igstkDeclareInputMacro( EmptyImageSpatialObject ); 00184 igstkDeclareInputMacro( SetSliceNumber ); 00185 igstkDeclareInputMacro( ValidSliceNumber ); 00186 igstkDeclareInputMacro( InvalidSliceNumber ); 00187 igstkDeclareInputMacro( ValidOrientation ); 00188 igstkDeclareInputMacro( RequestSliceNumberBounds ); 00189 igstkDeclareInputMacro( ConnectVTKPipeline ); 00190 00192 igstkDeclareStateMacro( NullImageSpatialObject ); 00193 igstkDeclareStateMacro( ValidImageSpatialObject ); 00194 igstkDeclareStateMacro( ValidImageOrientation ); 00195 igstkDeclareStateMacro( ValidSliceNumber ); 00196 igstkDeclareStateMacro( AttemptingToSetSliceNumber ); 00197 00199 SliceNumberType m_SliceNumberToBeSet; 00200 SliceNumberType m_SliceNumber; 00201 00203 OrientationType m_OrientationToBeSet; 00204 OrientationType m_Orientation; 00205 00207 typename VTKImageObserver::Pointer m_VTKImageObserver; 00208 typename ImageTransformObserver::Pointer m_ImageTransformObserver; 00209 00212 Transform m_ImageTransform; 00213 }; 00214 00215 } // end namespace igstk 00216 00217 #ifndef IGSTK_MANUAL_INSTANTIATION 00218 #include "igstkImageSpatialObjectRepresentation.txx" 00219 #endif 00220 00221 00222 #endif // __igstkImageSpatialObjectRepresentation_h