ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkCentralDifferenceImageFunction.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 __itkCentralDifferenceImageFunction_h
19 #define __itkCentralDifferenceImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkCovariantVector.h"
24 
25 namespace itk
26 {
40 template<
41  class TInputImage,
42  class TCoordRep = float >
44  public ImageFunction< TInputImage,
45  CovariantVector< double, \
46  TInputImage::ImageDimension >,
47  TCoordRep >
48 {
49 public:
50 
52  itkStaticConstMacro(ImageDimension, unsigned int,
53  TInputImage::ImageDimension);
54 
57  typedef ImageFunction< TInputImage,
58  CovariantVector< double,
59  itkGetStaticConstMacro(ImageDimension) >,
60  TCoordRep > Superclass;
63 
66 
68  itkNewMacro(Self);
69 
71  typedef TInputImage InputImageType;
72 
74  typedef typename Superclass::OutputType OutputType;
75 
77  typedef typename Superclass::IndexType IndexType;
78 
80  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
81 
83  typedef typename Superclass::PointType PointType;
84 
86  typedef typename TInputImage::SpacingType SpacingType;
87 
91 
93  virtual void SetInputImage(const TInputImage *inputData);
94 
97  virtual void SetInterpolator(InterpolatorType *interpolator);
98 
100  itkGetConstObjectMacro( Interpolator, InterpolatorType );
101 
113  virtual OutputType EvaluateAtIndex(const IndexType & index) const;
114 
127  virtual OutputType Evaluate(const PointType & point) const;
128 
140  virtual OutputType EvaluateAtContinuousIndex(
141  const ContinuousIndexType & cindex) const;
142 
157  itkSetMacro(UseImageDirection, bool);
158  itkGetConstMacro(UseImageDirection, bool);
159  itkBooleanMacro(UseImageDirection);
160 protected:
163  void PrintSelf(std::ostream & os, Indent indent) const;
165 
166 private:
167  CentralDifferenceImageFunction(const Self &); //purposely not implemented
168  void operator=(const Self &); //purposely not implemented
169 
170  // flag to take or not the image direction into account
171  // when computing the derivatives.
173 
174  // interpolator
176 };
177 } // end namespace itk
178 
179 // Define instantiation macro for this template.
180 #define ITK_TEMPLATE_CentralDifferenceImageFunction(_, EXPORT, TypeX, TypeY) \
181  namespace itk \
182  { \
183  _( 2 ( class EXPORT CentralDifferenceImageFunction< ITK_TEMPLATE_2 TypeX > ) ) \
184  namespace Templates \
185  { \
186  typedef CentralDifferenceImageFunction< ITK_TEMPLATE_2 TypeX > \
187  CentralDifferenceImageFunction##TypeY; \
188  } \
189  }
190 
191 #if ITK_TEMPLATE_EXPLICIT
192 // HACK: template < class TInputImage, class TCoordRep >
193 // const unsigned int
194 // CentralDifferenceImageFunction<TInputImage,TCoordRep>::ImageDimension;
195 #include "Templates/itkCentralDifferenceImageFunction+-.h"
196 #endif
197 
198 #if ITK_TEMPLATE_TXX
199 #include "itkCentralDifferenceImageFunction.hxx"
200 #endif
201 
202 #endif
203