ITK  4.9.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 >
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,
60  InputPixelType::Dimension);
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 
87 
89  typedef typename Superclass::IndexType IndexType;
90 
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  VectorCentralDifferenceImageFunction(const Self &) ITK_DELETE_FUNCTION;
153  void operator=(const Self &) ITK_DELETE_FUNCTION;
154 
155  // flag to take or not the image direction into account
156  // when computing the derivatives.
158 };
159 } // end namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "itkVectorCentralDifferenceImageFunction.hxx"
163 #endif
164 
165 #endif
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:47
Light weight base class for most itk classes.
Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > PointType
void PrintSelf(std::ostream &os, Indent indent) const override
ImageFunction< TInputImage, Matrix< double, itkGetStaticConstMacro(Dimension), itkGetStaticConstMacro(ImageDimension) >, TCoordRep > Superclass
virtual OutputType EvaluateAtIndex(const IndexType &index) const override
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
virtual OutputType Evaluate(const PointType &point) const override
InputImageType::IndexType IndexType
ContinuousIndex< TCoordRep, itkGetStaticConstMacro(ImageDimension) > ContinuousIndexType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Calculate the derivative by central differencing.
Evaluates a function of an image at specified position.