IGSTK
igstkImageReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkImageReader.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:50 $
7  Version: $Revision: 1.7 $
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 __igstkImageReader_h
18 #define __igstkImageReader_h
19 
20 #include "igstkMacros.h"
21 #include "igstkStateMachine.h"
22 #include "igstkObject.h"
23 
24 #include "itkImageSpatialObject.h"
25 
26 namespace igstk
27 {
28 
29 namespace Friends
30 {
31 
44 {
45 public:
46 
47  template < class TReader, class TImageSpatialObject >
48  static void
49  ConnectImage( const TReader * reader,
50  TImageSpatialObject * imageSpatialObject )
51  {
52  imageSpatialObject->RequestSetImage( reader->GetITKImage() );
53  }
54 
55 }; // end of ImageReaderToImageSpatialObject class
56 
57 } // end of Friend namespace
58 
59 
60 
71 template < class TImageSpatialObject >
72 class ImageReader : public Object
73 {
74 
75 public:
76 
79 
80 public:
81 
83  typedef TImageSpatialObject ImageSpatialObjectType;
84 
87  igstkFriendClassMacro( igstk::Friends::ImageReaderToImageSpatialObject );
88 
89 protected:
90 
91  ImageReader();
92  ~ImageReader();
93 
95  void PrintSelf( std::ostream& os, ::itk::Indent indent ) const;
96 
98  void ConnectImage();
99 
102  typedef typename ImageSpatialObjectType::ImageType ImageType;
103  typedef typename ImageType::ConstPointer ImagePointer;
104  typedef typename ImageType::RegionType ImageRegionType;
105 
106  typename ImageSpatialObjectType::Pointer m_ImageSpatialObject;
107 
108 private:
109 
112  ImageReader(const Self&); //purposely not implemented
113  void operator=(const Self&); //purposely not implemented
114 
115  // FIXME : This must be replaced with StateMachine logic
116  virtual const ImageType * GetITKImage() const = 0;
117 
118 };
119 
120 } // end namespace igstk
121 
122 #ifndef IGSTK_MANUAL_INSTANTIATION
123 #include "igstkImageReader.txx"
124 #endif
125 
126 #endif // __igstkImageReader_h
#define igstkFriendClassMacro(type)
Create a Macro for friend class.
Definition: igstkMacros.h:137
void ConnectImage()
Connect the ITK image to the output ImageSpatialObject.
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
igstkStandardTemplatedAbstractClassTraitsMacro(ImageReader, Object) public
Macro with standard traits declarations.
static void ConnectImage(const TReader *reader, TImageSpatialObject *imageSpatialObject)
defines standard system-wide macros, constants, and other common parameters in the IGSTK Library...
void PrintSelf(std::ostream &os,::itk::Indent indent) const
Print the object information in a stream.
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
ImageSpatialObjectType::ImageType ImageType
Some convenient typedefs for internal ITK image.
ImageSpatialObjectType::Pointer m_ImageSpatialObject
This class is intended to make the connection between the ImageReader and its output, the ImageSpatialObject.
This class is a base class for all image reader classes.
::itk::SmartPointer< const Self > ConstPointer
Definition: igstkObject.h:51