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/12/09 17:24:08 $ 00007 Version: $Revision: 1.47 $ 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 typename Superclass::IndexType IndexType; 00085 typedef typename IndexType::IndexValueType IndexValueType; 00086 00088 typedef typename Superclass::SizeType SizeType; 00089 typedef typename SizeType::SizeValueType SizeValueType; 00090 00092 typedef typename Superclass::OffsetType OffsetType; 00093 typedef typename OffsetType::OffsetValueType OffsetValueType; 00094 00097 typedef typename Superclass::RegionType RegionType; 00098 00101 typedef typename Superclass::SpacingType SpacingType; 00102 00105 typedef typename Superclass::PointType PointType; 00106 00113 virtual void SetLargestPossibleRegion(const RegionType &region); 00114 00118 virtual void SetBufferedRegion(const RegionType &region); 00119 00123 virtual void SetRequestedRegion(const RegionType &region); 00124 00129 virtual void SetRequestedRegion(DataObject *data); 00130 00137 virtual const RegionType & GetRequestedRegion() const; 00138 00147 virtual const RegionType& GetLargestPossibleRegion() const; 00148 00154 virtual const RegionType& GetBufferedRegion() const; 00155 00157 inline void Allocate(); 00158 00159 00162 virtual void Initialize(); 00163 00165 void SetPixel(const IndexType &index, const PixelType & value) 00166 { m_PixelAccessor.Set( m_Image->GetPixel(index), value ); } 00167 00169 PixelType GetPixel(const IndexType &index) const 00170 { return m_PixelAccessor.Get( m_Image->GetPixel(index) ); } 00171 00173 PixelType operator[](const IndexType &index) const 00174 { return m_PixelAccessor.Get( m_Image->GetPixel(index) ); } 00175 00177 const OffsetValueType *GetOffsetTable() const; 00178 00180 IndexType ComputeIndex(OffsetValueType offset) const; 00181 00184 typedef typename TImage::PixelContainer PixelContainer; 00185 typedef typename TImage::PixelContainerPointer PixelContainerPointer; 00186 typedef typename TImage::PixelContainerConstPointer PixelContainerConstPointer; 00187 00189 PixelContainerPointer GetPixelContainer() 00190 { return m_Image->GetPixelContainer(); }; 00191 00194 void SetPixelContainer( PixelContainer *container ); 00195 00197 typedef InternalPixelType * InternalPixelPointerType; 00198 00201 InternalPixelType *GetBufferPointer(); 00202 const InternalPixelType *GetBufferPointer() const; 00203 void GetBufferPointer2( InternalPixelPointerType & ); 00204 00206 virtual void SetSpacing( const SpacingType& values ); 00207 virtual void SetSpacing( const double values[ImageDimension] ); 00208 virtual void SetSpacing( const float values[ImageDimension] ); 00209 00213 virtual const SpacingType& GetSpacing() const; 00214 00218 virtual const PointType& GetOrigin() const; 00219 00221 virtual void SetOrigin( const PointType & values); 00222 virtual void SetOrigin( const double values[ImageDimension] ); 00223 virtual void SetOrigin( const float values[ImageDimension] ); 00224 00226 virtual void SetImage( TImage * ); 00227 00229 virtual void Modified() const; 00230 00232 virtual unsigned long GetMTime() const; 00233 00235 AccessorType & GetPixelAccessor( void ) 00236 { return m_PixelAccessor; } 00237 00239 const AccessorType & GetPixelAccessor( void ) const 00240 { return m_PixelAccessor; } 00241 00243 void SetPixelAccessor( const AccessorType & accessor ) 00244 { m_PixelAccessor = accessor; } 00245 00247 virtual void Update(); 00248 virtual void UpdateOutputInformation(); 00249 virtual void SetRequestedRegionToLargestPossibleRegion(); 00250 virtual void CopyInformation(const DataObject *data); 00251 00252 protected: 00253 ImageAdaptor(); 00254 virtual ~ImageAdaptor(); 00255 void PrintSelf(std::ostream& os, Indent indent) const; 00256 00257 private: 00258 ImageAdaptor(const Self&); //purposely not implemented 00259 void operator=(const Self&); //purposely not implemented 00260 00261 // Adapted image, most of the calls to ImageAdaptor 00262 // will be delegated to this image 00263 typename TImage::Pointer m_Image; 00264 00265 // Data accessor object, 00266 // it converts the presentation of a pixel 00267 AccessorType m_PixelAccessor; 00268 00269 00270 }; 00271 00272 } // end namespace itk 00273 00274 #ifndef ITK_MANUAL_INSTANTIATION 00275 #include "itkImageAdaptor.txx" 00276 #endif 00277 00278 00279 00280 #endif 00281

Generated at Sun Apr 1 02:33:36 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000