00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkTubeReader.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-05-05 20:41:09 $ 00007 Version: $Revision: 1.15 $ 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 __igstkTubeReader_h 00018 #define __igstkTubeReader_h 00019 00020 #include "igstkMacros.h" 00021 #include "igstkSpatialObjectReader.h" 00022 00023 #include "itkSpatialObjectReader.h" 00024 #include "itkObject.h" 00025 #include "itkEventObject.h" 00026 00027 #include "igstkTubeObject.h" 00028 #include "itkTubeSpatialObject.h" 00029 00030 namespace igstk 00031 { 00032 00033 namespace Friends 00034 { 00035 00045 class TubeReaderToTubeSpatialObject 00046 { 00047 public: 00048 00049 template < class TReader, class TTubeSpatialObject > 00050 static void 00051 ConnectTube( TReader * reader, 00052 TTubeSpatialObject * tubeSpatialObject ) 00053 { 00054 tubeSpatialObject->SetTubeSpatialObject( 00055 reader->GetITKTubeSpatialObject()); 00056 } 00057 00058 }; // end of TubeReaderToTubeSpatialObject class 00059 00060 } // end of Friend namespace 00061 00062 00077 class TubeReader : public SpatialObjectReader<3> 00078 { 00079 00080 public: 00081 00083 igstkStandardClassTraitsMacro( TubeReader, SpatialObjectReader<3> ) 00084 00085 public: 00086 00088 typedef Superclass::SpatialObjectType SpatialObjectType; 00089 typedef Superclass::GroupSpatialObjectType GroupSpatialObjectType; 00090 typedef SpatialObjectType::ConstPointer SpatialObjectTypeConstPointer; 00091 typedef igstk::TubeObject TubeType; 00092 typedef itk::TubeSpatialObject<3> TubeSpatialObjectType; 00093 00095 igstkEventMacro( TubeReaderEvent,ObjectReaderEvent ) 00096 igstkEventMacro( TubeReadingErrorEvent, ObjectReadingErrorEvent ) 00097 igstkLoadedObjectEventMacro( TubeModifiedEvent, TubeReaderEvent, TubeType ) 00098 00102 igstkFriendClassMacro( igstk::Friends::TubeReaderToTubeSpatialObject ); 00103 00104 protected: 00105 00107 TubeReader(); 00108 ~TubeReader(); 00109 00111 void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00112 00115 void AttemptReadObjectProcessing(); 00116 00118 void ReportObjectProcessing(); 00119 00121 void ConnectTube(); 00122 00123 private: 00124 00125 TubeReader(const Self&); //purposely not implemented 00126 void operator=(const Self&); //purposely not implemented 00127 00128 // FIXME : This must be replaced with StateMachine logic 00129 virtual TubeSpatialObjectType * GetITKTubeSpatialObject() const; 00130 00131 TubeType::Pointer m_Tube; 00132 TubeSpatialObjectType::Pointer m_TubeSpatialObject; 00133 }; 00134 00135 } // end namespace igstk 00136 00137 00138 #endif // __igstkTubeReader_h