ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkVectorCentralDifferenceImageFunction.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 itkVectorCentralDifferenceImageFunction_h
19 #define itkVectorCentralDifferenceImageFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkMatrix.h"
23 
24 namespace itk
25 {
26 
45 template<
46  typename TInputImage,
47  typename TCoordRep = float >
48 class ITK_TEMPLATE_EXPORT VectorCentralDifferenceImageFunction:
49  public ImageFunction< TInputImage,
50  Matrix< double,
51  TInputImage::PixelType::Dimension,
52  TInputImage::ImageDimension >,
53  TCoordRep >
54 {
55 public:
56  typedef typename TInputImage::PixelType InputPixelType;
57 
59  itkStaticConstMacro(Dimension, unsigned int,
61 
63  itkStaticConstMacro(ImageDimension, unsigned int,
64  TInputImage::ImageDimension);
65 
68  typedef ImageFunction< TInputImage,
69  Matrix< double, itkGetStaticConstMacro(Dimension),
70  itkGetStaticConstMacro(ImageDimension) >,
71  TCoordRep > Superclass;
75 
78 
80  itkNewMacro(Self);
81 
83  typedef TInputImage InputImageType;
84 
86  typedef typename Superclass::OutputType OutputType;
87 
89  typedef typename Superclass::IndexType IndexType;
90 
92  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
93 
95  typedef typename Superclass::PointType PointType;
96 
104  virtual OutputType EvaluateAtIndex(const IndexType & index) const ITK_OVERRIDE;
105 
114  virtual OutputType Evaluate(const PointType & point) const ITK_OVERRIDE
115  {
116  IndexType index;
117 
118  this->ConvertPointToNearestIndex(point, index);
119  return this->EvaluateAtIndex(index);
120  }
121 
123  const ContinuousIndexType & cindex) const ITK_OVERRIDE
124  {
125  IndexType index;
126 
127  this->ConvertContinuousIndexToNearestIndex(cindex, index);
128  return this->EvaluateAtIndex(index);
129  }
130 
141  itkSetMacro(UseImageDirection, bool);
142  itkGetConstMacro(UseImageDirection, bool);
143  itkBooleanMacro(UseImageDirection);
145 
146 protected:
149  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
150 
151 private:
152  ITK_DISALLOW_COPY_AND_ASSIGN(VectorCentralDifferenceImageFunction);
153 
154  // flag to take or not the image direction into account
155  // when computing the derivatives.
156  bool m_UseImageDirection;
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkVectorCentralDifferenceImageFunction.hxx"
162 #endif
163 
164 #endif
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:53
Light weight base class for most itk classes.
ImageFunction< TInputImage, Matrix< double, itkGetStaticConstMacro(Dimension), itkGetStaticConstMacro(ImageDimension) >, TCoordRep > Superclass
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
virtual OutputType Evaluate(const PointType &point) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Calculate the derivative by central differencing.
Evaluates a function of an image at specified position.