ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkDerivativeOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkDerivativeOperator_h
19 #define __itkDerivativeOperator_h
20 
22 
23 namespace itk
24 {
65 template< class TPixel, unsigned int VDimension = 2,
66  class TAllocator = NeighborhoodAllocator< TPixel > >
67 class ITK_EXPORT DerivativeOperator:
68  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
69 {
70 public:
71 
74  typedef NeighborhoodOperator<
75  TPixel, VDimension, TAllocator > Superclass;
76 
77  typedef typename Superclass::PixelType PixelType;
79 
81  DerivativeOperator():m_Order(1) {}
82 
84  DerivativeOperator(const Self & other):
85  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
86  { m_Order = other.m_Order; }
87 
89  Self & operator=(const Self & other)
90  {
91  Superclass::operator=(other);
92  m_Order = other.m_Order;
93  return *this;
94  }
96 
98  void SetOrder(const unsigned int & order)
99  {
100  this->m_Order = order;
101  }
102 
104  unsigned int GetOrder() const { return m_Order; }
105 
107  virtual void PrintSelf(std::ostream & os, Indent i) const
108  {
109  os << i << "DerivativeOperator { this=" << this
110  << ", m_Order = " << m_Order << "}" << std::endl;
111  Superclass::PrintSelf( os, i.GetNextIndent() );
112  }
114 
115 protected:
119 
121  CoefficientVector GenerateCoefficients();
122 
124  void Fill(const CoefficientVector & coeff)
125  { Superclass::FillCenteredDirectional(coeff); }
126 private:
127 
129  unsigned int m_Order;
130 };
131 } // namespace itk
132 
133 // Define instantiation macro for this template.
134 #define ITK_TEMPLATE_DerivativeOperator(_, EXPORT, TypeX, TypeY) \
135  namespace itk \
136  { \
137  _( 2 ( class EXPORT DerivativeOperator< ITK_TEMPLATE_2 TypeX > ) ) \
138  namespace Templates \
139  { \
140  typedef DerivativeOperator< ITK_TEMPLATE_2 TypeX > \
141  DerivativeOperator##TypeY; \
142  } \
143  }
144 
145 #if ITK_TEMPLATE_EXPLICIT
146 #include "Templates/itkDerivativeOperator+-.h"
147 #endif
148 
149 #if ITK_TEMPLATE_TXX
150 #include "itkDerivativeOperator.hxx"
151 #endif
152 
153 #endif
154