00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNthElementImageAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/01/15 18:57:09 $ 00007 Version: $Revision: 1.8 $ 00008 00009 Copyright (c) 2002 Insight 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 __itkNthElementImageAdaptor_h 00018 #define __itkNthElementImageAdaptor_h 00019 00020 #include <itkImageAdaptor.h> 00021 #include <itkNthElementPixelAccessor.h> 00022 00023 namespace itk 00024 { 00025 00037 template <class TImage, class TOutputPixelType> 00038 class ITK_EXPORT NthElementImageAdaptor : public 00039 ImageAdaptor<TImage, 00040 NthElementPixelAccessor< 00041 TOutputPixelType, 00042 typename TImage::PixelType> > 00043 { 00044 public: 00046 typedef NthElementImageAdaptor Self; 00047 typedef ImageAdaptor<TImage,NthElementImageAdaptor< 00048 TOutputPixelType, 00049 typename TImage::PixelType > > Superclass; 00050 typedef SmartPointer<Self> Pointer; 00051 typedef SmartPointer<const Self> ConstPointer; 00052 00054 itkTypeMacro( NthElementImageAdaptor, ImageAdaptor ); 00055 00057 itkNewMacro(Self); 00058 00060 void SelectNthElement( unsigned int nth ) 00061 { this->GetPixelAccessor().SetElementNumber( nth ); 00062 this->Modified(); } 00063 00064 protected: 00065 NthElementImageAdaptor() {} 00066 virtual ~NthElementImageAdaptor() {} 00067 00068 private: 00069 NthElementImageAdaptor(const Self&); //purposely not implemented 00070 void operator=(const Self&); //purposely not implemented 00071 }; 00072 00073 00074 } // end namespace itk 00075 00076 #endif