Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageAdaptor.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkImageAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:09 $ 00007 Version: $Revision: 1.45 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/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 __itkImageAdaptor_h 00018 #define __itkImageAdaptor_h 00019 00020 #include "itkImage.h" 00021 00022 namespace itk 00023 { 00024 00046 template <class TImage, class TAccessor > 00047 class ITK_EXPORT ImageAdaptor : public ImageBase< ::itk::GetImageDimension<TImage>::ImageDimension> 00048 { 00049 public: 00054 itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension); 00055 00057 typedef ImageAdaptor Self; 00058 typedef ImageBase<itkGetStaticConstMacro(ImageDimension)> Superclass; 00059 typedef SmartPointer<Self> Pointer; 00060 typedef SmartPointer<const Self> ConstPointer; 00061 00063 itkTypeMacro(ImageAdaptor, ImageBase); 00064 00066 typedef TImage InternalImageType; 00067 00069 itkNewMacro(Self); 00070 00073 typedef typename TAccessor::ExternalType PixelType; 00074 00077 typedef typename TAccessor::InternalType InternalPixelType; 00078 00081 typedef TAccessor AccessorType; 00082 00084 typedef Index<itkGetStaticConstMacro(ImageDimension)> IndexType; 00085 typedef typename IndexType::IndexValueType IndexValueType; 00086 00088 typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType; 00089 typedef typename SizeType::SizeValueType SizeValueType; 00090 00092 typedef Offset<itkGetStaticConstMacro(ImageDimension)> OffsetType; 00093 typedef typename OffsetType::OffsetValueType OffsetValueType; 00094 00097 typedef ImageRegion<itkGetStaticConstMacro(ImageDimension)> RegionType; 00098 00105 virtual void SetLargestPossibleRegion(const RegionType &region); 00106 00110 virtual void SetBufferedRegion(const RegionType &region); 00111 00115 virtual void SetRequestedRegion(const RegionType &region); 00116 00121 virtual void SetRequestedRegion(DataObject *data); 00122 00129 virtual const RegionType & GetRequestedRegion() const; 00130 00139 virtual const RegionType& GetLargestPossibleRegion() const; 00140 00146 virtual const RegionType& GetBufferedRegion() const; 00147 00149 inline void Allocate(); 00150 00151 00154 virtual void Initialize(); 00155 00157 void SetPixel(const IndexType &index, const PixelType & value) 00158 { m_PixelAccessor.Set( m_Image->GetPixel(index), value ); } 00159 00161 PixelType GetPixel(const IndexType &index) const 00162 { return m_PixelAccessor.Get( m_Image->GetPixel(index) ); } 00163 00165 PixelType operator[](const IndexType &index) const 00166 { return m_PixelAccessor.Get( m_Image->GetPixel(index) ); } 00167 00169 const OffsetValueType *GetOffsetTable() const; 00170 00172 IndexType ComputeIndex(OffsetValueType offset) const; 00173 00176 typedef typename TImage::PixelContainer PixelContainer; 00177 typedef typename TImage::PixelContainerPointer PixelContainerPointer; 00178 00180 PixelContainerPointer GetPixelContainer() 00181 { return m_Image->GetPixelContainer(); }; 00182 00185 void SetPixelContainer( PixelContainer *container ); 00186 00188 typedef InternalPixelType * InternalPixelPointerType; 00189 00192 InternalPixelType *GetBufferPointer(); 00193 const InternalPixelType *GetBufferPointer() const; 00194 void GetBufferPointer2( InternalPixelPointerType & ); 00195 00197 virtual void SetSpacing( const double values[ImageDimension] ); 00198 virtual void SetSpacing( const float values[ImageDimension] ); 00199 00204 virtual const double* GetSpacing() const; 00205 00210 virtual const double * GetOrigin() const; 00211 00213 virtual void SetOrigin( const double values[ImageDimension] ); 00214 virtual void SetOrigin( const float values[ImageDimension] ); 00215 00217 virtual void SetImage( TImage * ); 00218 00220 virtual void Modified() const; 00221 00223 virtual unsigned long GetMTime() const; 00224 00226 AccessorType & GetPixelAccessor( void ) 00227 { return m_PixelAccessor; } 00228 00230 const AccessorType & GetPixelAccessor( void ) const 00231 { return m_PixelAccessor; } 00232 00234 void SetPixelAccessor( const AccessorType & accessor ) 00235 { m_PixelAccessor = accessor; } 00236 00238 virtual void Update(); 00239 virtual void UpdateOutputInformation(); 00240 virtual void SetRequestedRegionToLargestPossibleRegion(); 00241 virtual void CopyInformation(const DataObject *data); 00242 00243 protected: 00244 ImageAdaptor(); 00245 virtual ~ImageAdaptor(); 00246 void PrintSelf(std::ostream& os, Indent indent) const; 00247 00248 private: 00249 ImageAdaptor(const Self&); //purposely not implemented 00250 void operator=(const Self&); //purposely not implemented 00251 00252 // Adapted image, most of the calls to ImageAdaptor 00253 // will be delegated to this image 00254 typename TImage::Pointer m_Image; 00255 00256 // Data accessor object, 00257 // it converts the presentation of a pixel 00258 AccessorType m_PixelAccessor; 00259 00260 00261 }; 00262 00263 } // end namespace itk 00264 00265 #ifndef ITK_MANUAL_INSTANTIATION 00266 #include "itkImageAdaptor.txx" 00267 #endif 00268 00269 00270 00271 #endif 00272

Generated at Sat Mar 31 02:20:50 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000