00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNthElementImageAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2004/11/10 19:22:12 $ 00007 Version: $Revision: 1.11 $ 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 __itkNthElementImageAdaptor_h 00018 #define __itkNthElementImageAdaptor_h 00019 00020 #include <itkImageAdaptor.h> 00021 #include <itkNthElementPixelAccessor.h> 00022 00023 namespace itk 00024 { 00025 00039 // Create a helper class to help the SunPro CC compiler 00040 // parse the templates for the NthElementImageAdaptor. 00041 // This is used to define the Super class. for NthElementImageAdaptor 00042 template <class TImage, class TOutputPixelType> 00043 class ITK_EXPORT NthElementImageAdaptorHelper 00044 { 00045 public: 00046 typedef NthElementPixelAccessor< 00047 TOutputPixelType, 00048 typename TImage::PixelType> PixelAccessor; 00049 00050 typedef ImageAdaptor<TImage, PixelAccessor> Super; 00051 }; 00052 00053 00054 00055 template <class TImage, class TOutputPixelType> 00056 class ITK_EXPORT NthElementImageAdaptor : public NthElementImageAdaptorHelper<TImage, TOutputPixelType>::Super 00057 { 00058 public: 00060 typedef NthElementImageAdaptor Self; 00061 typedef typename NthElementImageAdaptorHelper<TImage, TOutputPixelType>::Super Superclass; 00062 typedef SmartPointer<Self> Pointer; 00063 typedef SmartPointer<const Self> ConstPointer; 00064 00066 itkTypeMacro( NthElementImageAdaptor, ImageAdaptor ); 00067 00069 itkNewMacro(Self); 00070 00072 void SelectNthElement( unsigned int nth ) 00073 { this->GetPixelAccessor().SetElementNumber( nth ); 00074 this->Modified(); } 00075 00076 protected: 00077 NthElementImageAdaptor() {} 00078 virtual ~NthElementImageAdaptor() {} 00079 00080 private: 00081 NthElementImageAdaptor(const Self&); //purposely not implemented 00082 void operator=(const Self&); //purposely not implemented 00083 }; 00084 00085 00086 } // end namespace itk 00087 00088 #endif