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

itkVectorImageToImageAdaptor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorImageToImageAdaptor.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-08-04 15:56:22 $
00007   Version:   $Revision: 1.9 $
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 __itkVectorImageToImageAdaptor_h
00018 #define __itkVectorImageToImageAdaptor_h
00019 
00020 #include "itkImageAdaptor.h"
00021 #include "itkVectorImage.h"
00022 
00023 namespace itk
00024 {
00025 namespace Accessor
00026 {
00027 
00042 template <class TType >
00043 class ITK_EXPORT VectorImageToImagePixelAccessor  
00044 {
00045 public:
00046 
00047   typedef unsigned int VectorLengthType;
00048   
00051   typedef  TType                 ExternalType;
00052 
00055   typedef VariableLengthVector< TType >         InternalType;
00056 
00058   typedef TType                  PixelType;
00059 
00060   inline void Set(InternalType output, const ExternalType & input) const
00061     { 
00062     output[m_ComponentIdx] = input;
00063     }
00064 
00065   inline ExternalType Get( const InternalType & input ) const
00066     {
00067     ExternalType output;
00068     output = input[m_ComponentIdx];
00069     return output;
00070     }
00071 
00072   void SetExtractComponentIdx( VectorLengthType idx )
00073     {
00074     m_ComponentIdx = idx;
00075     }
00076   VectorLengthType GetExtractComponentIdx() const
00077     {
00078     return m_ComponentIdx;
00079     }
00080   
00081   VectorImageToImagePixelAccessor() : m_ComponentIdx( 0 ) {};
00082   virtual ~VectorImageToImagePixelAccessor() {};
00083   
00084 private:
00085   VectorLengthType m_ComponentIdx;
00086 };
00087 
00088 } // end namespace Accessor
00089 
00090 
00091 
00109 template<class TPixelType, unsigned int Dimension>
00110 class ITK_EXPORT VectorImageToImageAdaptor : public
00111       ImageAdaptor< VectorImage< TPixelType, Dimension >,
00112         Accessor::VectorImageToImagePixelAccessor< TPixelType > >
00113 {
00114 public:
00116   typedef VectorImageToImageAdaptor    Self;
00117   typedef VectorImage< TPixelType, Dimension > VectorImageType;
00118   typedef ImageAdaptor< VectorImageType,
00119       Accessor::VectorImageToImagePixelAccessor< TPixelType >  > Superclass;
00120   typedef SmartPointer<Self>  Pointer;
00121   typedef SmartPointer<const Self>  ConstPointer;
00122 
00124   itkNewMacro(Self);  
00125 
00127   itkTypeMacro( VectorImageToImageAdaptor, ImageAdaptor );
00128 
00131   typedef typename Superclass::PixelContainer        PixelContainer;
00132   typedef typename Superclass::PixelContainerPointer PixelContainerPointer;
00133   typedef typename Superclass::PixelContainerConstPointer PixelContainerConstPointer;
00134   typedef typename Superclass::IOPixelType                IOPixelType;
00135 
00137   typedef typename VectorImageType::VectorLengthType      VectorLengthType;
00138 
00139   // Set/GetMethods to set the component to be extracted.
00140   void SetExtractComponentIndex( VectorLengthType componentIdx )
00141     {
00142     this->GetPixelAccessor().SetExtractComponentIdx( componentIdx );
00143     }
00144 
00145   // Set/GetMethods to set the component to be extracted.
00146   VectorLengthType GetExtractComponentIndex() const
00147     {
00148     return this->GetPixelAccessor().GetExtractComponentIdx();
00149     }
00150   
00151  protected:
00152   VectorImageToImageAdaptor() {}
00153   virtual ~VectorImageToImageAdaptor() {}
00154   
00155  private:
00156   VectorImageToImageAdaptor(const Self&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158 
00159 };
00160 
00161   
00162 } // end namespace itk
00163   
00164 #endif
00165 

Generated at Thu Nov 6 00:43:56 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000