ImageFunction.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2015 Daniel Rueckert, Julia Schnabel
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_ImageFunction_H
21 #define MIRTK_ImageFunction_H
22 
23 #include "mirtk/Object.h"
24 #include "mirtk/BaseImage.h"
25 
26 
27 namespace mirtk {
28 
29 
30 /**
31  * Abstract base class for any general image interpolation function filter.
32  *
33  * This is the abstract base class which defines a common interface for all
34  * filters which take an image as input and sample that image at arbitrary
35  * location. Each derived class has to implement all abstract member functions.
36  */
37 class ImageFunction : public Object
38 {
39  mirtkAbstractMacro(ImageFunction);
40 
41  // ---------------------------------------------------------------------------
42  // Attributes
43 
44  /// Input image
45  mirtkPublicAggregateMacro(const BaseImage, Input);
46 
47  /// Default value to return
48  mirtkPublicAttributeMacro(double, DefaultValue);
49 
50  // ---------------------------------------------------------------------------
51  // Construction/Destruction
52 protected:
53 
54  /// Default constructor
55  ImageFunction();
56 
57  /// Copy constructor
59 
60 public:
61 
62  /// Destructor
63  virtual ~ImageFunction();
64 
65  // ---------------------------------------------------------------------------
66  // Initialization
67 
68  /// Initialize the filter. This function must be called by any derived
69  /// filter class to perform some initialize tasks.
70  virtual void Initialize();
71 
72  // ---------------------------------------------------------------------------
73  // Evaluation
74 
75  /// Evaluate the filter at an arbitrary image location (in pixels)
76  virtual double Evaluate(double, double, double, double = 0) const = 0;
77 
78 };
79 
80 
81 } // namespace mirtk
82 
83 #endif // MIRTK_ImageFunction_H
virtual void Initialize()
ImageFunction()
Default constructor.
virtual double Evaluate(double, double, double, double=0) const =0
Evaluate the filter at an arbitrary image location (in pixels)
Definition: IOConfig.h:41
virtual ~ImageFunction()
Destructor.