ITK  4.4.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  class TInputImage,
47  class 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 
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;
105 
114  virtual OutputType Evaluate(const PointType & point) const
115  {
116  IndexType index;
117 
118  this->ConvertPointToNearestIndex(point, index);
119  return this->EvaluateAtIndex(index);
120  }
121 
122  virtual OutputType EvaluateAtContinuousIndex(
123  const ContinuousIndexType & cindex) const
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;
150 
151 private:
152  VectorCentralDifferenceImageFunction(const Self &); //purposely not
153  // implemented
154  void operator=(const Self &); //purposely not
155  // implemented
156 
157  // flag to take or not the image direction into account
158  // when computing the derivatives.
160 };
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkVectorCentralDifferenceImageFunction.hxx"
165 #endif
166 
167 #endif
168