ITK  4.3.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"
25 #include "itkEnableIf.h"
26 #include "itkIsSame.h"
27 
28 namespace itk
29 {
75 template<
76  class TInputImage,
77  class TCoordRep = float,
78  class TOutputType = CovariantVector<double, TInputImage::ImageDimension >
79  >
81  public ImageFunction< TInputImage,
82  TOutputType,
83  TCoordRep >
84 {
85 public:
86 
88  itkStaticConstMacro(ImageDimension, unsigned int,
89  TInputImage::ImageDimension);
90 
93  typedef ImageFunction< TInputImage,
94  TOutputType,
95  TCoordRep > Superclass;
98 
101 
103  itkNewMacro(Self);
104 
106  typedef TInputImage InputImageType;
107 
109  typedef typename InputImageType::PixelType InputPixelType;
110 
113 
115  typedef typename Superclass::OutputType OutputType;
116 
119 
122 
125 
127  typedef typename Superclass::IndexType IndexType;
128 
130  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
131 
133  typedef typename Superclass::PointType PointType;
134 
136  typedef typename TInputImage::SpacingType SpacingType;
137 
141 
143  virtual void SetInputImage(const TInputImage *inputData);
144 
147  virtual void SetInterpolator(InterpolatorType *interpolator);
148 
150  itkGetConstObjectMacro( Interpolator, InterpolatorType );
151 
162  virtual OutputType EvaluateAtIndex(const IndexType & index) const;
163 
177  virtual OutputType Evaluate(const PointType & point) const;
178 
190  virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & cindex) const;
191 
206  itkSetMacro(UseImageDirection, bool);
207  itkGetConstMacro(UseImageDirection, bool);
208  itkBooleanMacro(UseImageDirection);
210 
211 protected:
214  void PrintSelf(std::ostream & os, Indent indent) const;
215 
216 private:
217  CentralDifferenceImageFunction(const Self &); //purposely not implemented
218  void operator=(const Self &); //purposely not implemented
219 
220 
222  template<typename T>
224  {
225  typedef T Type;
226  };
227 
229  template< class Type >
230  inline void EvaluateAtIndexSpecialized( const IndexType & index, OutputType & derivative, OutputTypeSpecializationStructType<OutputType>) const;
231  template< class Type >
232  inline void EvaluateAtIndexSpecialized( const IndexType & index, OutputType & derivative, OutputTypeSpecializationStructType<Type>) const;
234 
236  template< class Type >
237  inline void EvaluateAtContinuousIndexSpecialized( const ContinuousIndexType & index, OutputType & derivative, OutputTypeSpecializationStructType<OutputType>) const;
238  template< class Type >
239  inline void EvaluateAtContinuousIndexSpecialized( const ContinuousIndexType & index, OutputType & derivative, OutputTypeSpecializationStructType<Type>) const;
241 
243  // NOTE: for some unknown reason, making these methods inline (as those above are inlined) makes them run *slower*.
244  template< class Type >
245  void EvaluateSpecialized( const PointType & point, OutputType & derivative, OutputTypeSpecializationStructType<OutputType>) const;
246  template< class Type >
247  void EvaluateSpecialized( const PointType & point, OutputType & derivative, OutputTypeSpecializationStructType<Type>) const;
249 
250  // flag to take or not the image direction into account
251  // when computing the derivatives.
253 
254  // interpolator
256 };
257 } // end namespace itk
258 
259 #ifndef ITK_MANUAL_INSTANTIATION
260 #include "itkCentralDifferenceImageFunction.hxx"
261 #endif
262 
263 #endif
264