ImageEdgeForce.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
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 MIRKT_ImageEdgeForce_H
21 #define MIRKT_ImageEdgeForce_H
22 
23 #include "mirtk/ExternalForce.h"
24 
25 #include "mirtk/GenericImage.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * External surface force which attracts the surface to image edges
33  */
35 {
36  mirtkEnergyTermMacro(ImageEdgeForce, EM_ImageEdgeForce);
37 
38  // ---------------------------------------------------------------------------
39  // Attributes
40 
41  /// Standard deviation of Gaussian smoothing kernel
42  mirtkPublicAttributeMacro(double, Sigma);
43 
44  /// Whether to project edge field gradient onto face normal
45  mirtkPublicAttributeMacro(bool, InNormalDirection);
46 
47  /// Edge field
48  mirtkAttributeMacro(RealImage, EdgeField);
49 
50  // ---------------------------------------------------------------------------
51  // Construction/Destruction
52 
53 protected:
54 
55  /// Copy attributes of this class from another instance
56  void CopyAttributes(const ImageEdgeForce &);
57 
58 public:
59 
60  /// Constructor
61  ImageEdgeForce(const char * = "", double = 1.0);
62 
63  /// Copy constructor
65 
66  /// Assignment operator
68 
69  /// Destructor
70  virtual ~ImageEdgeForce();
71 
72  // ---------------------------------------------------------------------------
73  // Configuration
74 
75 protected:
76 
77  /// Set parameter value from string
78  virtual bool SetWithoutPrefix(const char *, const char *);
79 
80 public:
81 
82  // Import other overloads
84 
85  /// Get parameter name/value pairs
86  virtual ParameterList Parameter() const;
87 
88  // ---------------------------------------------------------------------------
89  // Initialization
90 
91  /// Initialize external force once input and parameters have been set
92  virtual void Initialize();
93 
94  // ---------------------------------------------------------------------------
95  // Evaluation
96 
97 protected:
98 
99  /// Evaluate external force
100  virtual void EvaluateGradient(double *, double, double);
101 
102 };
103 
104 
105 } // namespace mirtk
106 
107 #endif // MIRKT_ImageEdgeForce_H
virtual void Initialize()
Initialize external force once input and parameters have been set.
virtual ParameterList Parameter() const
Get parameter name/value pairs.
void CopyAttributes(const ImageEdgeForce &)
Copy attributes of this class from another instance.
virtual void EvaluateGradient(double *, double, double)
Evaluate external force.
virtual bool SetWithoutPrefix(const char *, const char *)
Set parameter value from string.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
virtual ~ImageEdgeForce()
Destructor.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
Definition: IOConfig.h:41
ImageEdgeForce(const char *="", double=1.0)
Constructor.
ImageEdgeForce & operator=(const ImageEdgeForce &)
Assignment operator.
Image edge force.
Definition: EnergyMeasure.h:71