KWStyle - itkNthElementImageAdaptor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkNthElementImageAdaptor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:42 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkNthElementImageAdaptor_h
18 #define __itkNthElementImageAdaptor_h
19
20 #include <itkImageAdaptor.h>
21 #include <itkNthElementPixelAccessor.h>
22
23 namespace itk
24 {
25  
26 /** \class NthElementImageAdaptor
27  * \brief Presents an image as being composed of the N-th element of its pixels
28  *
29  * It assumes that the pixels are of container type and have in their API
30  * an operator[]( unsigned int ) defined.
31  *
32  * Additional casting is performed according to the input and output image
33  * types following C++ default casting rules.
34  *
35  * \ingroup ImageAdaptors
36  */
37
38
39 // Create a helper class to help the SunPro CC compiler
40 // parse the templates for the NthElementImageAdaptor.
41 // This is used to define the Super class.  for NthElementImageAdaptor
42 template <class TImage, class TOutputPixelType>
43 class ITK_EXPORT NthElementImageAdaptorHelper
44 {
45 IND *public:
46   typedef  NthElementPixelAccessor<
47     TOutputPixelType,
48     typename TImage::PixelType> PixelAccessor;
49
50   typedef  ImageAdaptor<TImage, PixelAccessor> Super;
51 };
52
53     
54
55 template <class TImage, class TOutputPixelType>
56 LEN,IND **class ITK_EXPORT NthElementImageAdaptor : public NthElementImageAdaptorHelper<TImage, TOutputPixelType>::Super
57 {
58 public:
59   /** Standard class typedefs. */
60   typedef NthElementImageAdaptor  Self;
61 LEN,TDA   typedef typename NthElementImageAdaptorHelper<TImage, TOutputPixelType>::Super Superclass;
62 TDA   typedef SmartPointer<Self>  Pointer;
63 TDA   typedef SmartPointer<const Self>  ConstPointer;
64   
65   /** Run-time type information (and related methods). */
66   itkTypeMacro( NthElementImageAdaptor, ImageAdaptor );
67
68   /** Method for creation through the object factory. */
69   itkNewMacro(Self);  
70
71   /** Select the element number to be accessed */
72   void SelectNthElement( unsigned int nth ) 
73     { this->GetPixelAccessor().SetElementNumber( nth ); 
74     this->Modified(); }
75
76 protected:
77   NthElementImageAdaptor() {}
78   virtual ~NthElementImageAdaptor() {}
79   
80 private:
81   NthElementImageAdaptor(const Self&); //purposely not implemented
82   void operator=(const Self&); //purposely not implemented
83 };
84
85
86 // end namespace itk
87
88 #endif
89

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:27PM
© Kitware Inc.