IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkVideoFrameRepresentation.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-18 18:40:55 $ 00007 Version: $Revision: 1.1 $ 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 __igstkVideoFrameRepresentation_h 00018 #define __igstkVideoFrameRepresentation_h 00019 00020 #include "igstkVideoFrameSpatialObject.h" 00021 #include "igstkObjectRepresentation.h" 00022 00023 class vtkImageData; 00024 class vtkImageActor; 00025 class vtkLookupTable; 00026 class vtkImageMapToColors; 00027 00028 namespace igstk 00029 { 00030 00031 template < class TVideoFrameSpatialObject > 00032 class VideoFrameRepresentation : public ObjectRepresentation 00033 { 00034 00035 public: 00036 igstkStandardTemplatedClassTraitsMacro( VideoFrameRepresentation, 00037 ObjectRepresentation ) 00038 00039 00041 typedef itk::ReceptorMemberCommand < Self > LoadedObserverType; 00042 00043 typedef TVideoFrameSpatialObject VideoFrameSpatialObjectType; 00044 typedef typename VideoFrameSpatialObjectType::ConstPointer 00045 VideoFrameSpatialObjectConstPointer; 00046 00048 void RequestSetVideoFrameSpatialObject(const VideoFrameSpatialObjectType* 00049 spatialObject); 00050 00054 igstkObserverMacro( VTKImage, VTKImageModifiedEvent, 00055 EventHelperType::VTKImagePointerType ); 00056 00058 void SetWindowLevel( double window, double level ); 00059 00060 void SaveScreenShot( const std::string & filename ); 00061 00063 Pointer Copy() const; 00064 00065 protected: 00066 VideoFrameRepresentation(void); 00067 00068 ~VideoFrameRepresentation(void); 00069 00071 void DeleteActors(); 00072 00073 bool VerifyTimeStamp( ) const; 00074 00076 void CreateActors(); 00077 00078 private: 00079 00081 VideoFrameSpatialObjectConstPointer m_VideoFrameSpatialObject; 00082 VideoFrameSpatialObjectConstPointer m_VideoFrameSpatialObjectToAdd; 00083 00085 vtkImageData *m_ImageData; 00086 vtkImageActor *m_ImageActor; 00087 vtkLookupTable *m_LookupTable; 00088 vtkImageMapToColors *m_MapColors; 00089 00090 double m_Level; 00091 double m_Window; 00092 double m_Shift; 00093 double m_Scale; 00094 00095 std::string m_ScreenShotFileName; 00096 00098 virtual void UpdateRepresentationProcessing(); 00099 00101 void NoProcessing(); 00102 00105 void SetVideoFrameSpatialObjectProcessing(); 00106 00109 void SetImage( const vtkImageData * image ); 00110 00112 void ConnectVTKPipelineProcessing(); 00113 00115 typename VTKImageObserver::Pointer m_VTKImageObserver; 00116 00118 igstkDeclareInputMacro( ValidVideoFrameSpatialObject ); 00119 igstkDeclareInputMacro( NullVideoFrameSpatialObject ); 00120 igstkDeclareInputMacro( EmptyVideoFrameSpatialObject ); 00121 igstkDeclareInputMacro( ConnectVTKPipeline ); 00122 00124 igstkDeclareStateMacro( NullVideoFrameSpatialObject ); 00125 igstkDeclareStateMacro( ValidVideoFrameSpatialObject ); 00126 }; 00127 00128 } // end namespace igstk 00129 00130 #ifndef IGSTK_MANUAL_INSTANTIATION 00131 #include "igstkVideoFrameRepresentation.txx" 00132 #endif 00133 00134 #endif // __igstkVideoFrameRepresentation_h