IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkImageReader.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.7 $ 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 __igstkImageReader_h 00018 #define __igstkImageReader_h 00019 00020 #include "igstkMacros.h" 00021 #include "igstkStateMachine.h" 00022 #include "igstkObject.h" 00023 00024 #include "itkImageSpatialObject.h" 00025 00026 namespace igstk 00027 { 00028 00029 namespace Friends 00030 { 00031 00043 class ImageReaderToImageSpatialObject 00044 { 00045 public: 00046 00047 template < class TReader, class TImageSpatialObject > 00048 static void 00049 ConnectImage( const TReader * reader, 00050 TImageSpatialObject * imageSpatialObject ) 00051 { 00052 imageSpatialObject->RequestSetImage( reader->GetITKImage() ); 00053 } 00054 00055 }; // end of ImageReaderToImageSpatialObject class 00056 00057 } // end of Friend namespace 00058 00059 00060 00071 template < class TImageSpatialObject > 00072 class ImageReader : public Object 00073 { 00074 00075 public: 00076 00078 igstkStandardTemplatedAbstractClassTraitsMacro( ImageReader, Object ) 00079 00080 public: 00081 00083 typedef TImageSpatialObject ImageSpatialObjectType; 00084 00087 igstkFriendClassMacro( igstk::Friends::ImageReaderToImageSpatialObject ); 00088 00089 protected: 00090 00091 ImageReader(); 00092 ~ImageReader(); 00093 00095 void PrintSelf( std::ostream& os, ::itk::Indent indent ) const; 00096 00098 void ConnectImage(); 00099 00102 typedef typename ImageSpatialObjectType::ImageType ImageType; 00103 typedef typename ImageType::ConstPointer ImagePointer; 00104 typedef typename ImageType::RegionType ImageRegionType; 00105 00106 typename ImageSpatialObjectType::Pointer m_ImageSpatialObject; 00107 00108 private: 00109 00112 ImageReader(const Self&); //purposely not implemented 00113 void operator=(const Self&); //purposely not implemented 00114 00115 // FIXME : This must be replaced with StateMachine logic 00116 virtual const ImageType * GetITKImage() const = 0; 00117 00118 }; 00119 00120 } // end namespace igstk 00121 00122 #ifndef IGSTK_MANUAL_INSTANTIATION 00123 #include "igstkImageReader.txx" 00124 #endif 00125 00126 #endif // __igstkImageReader_h