ConformalSurfaceFlattening.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2016 Imperial College London
5  * Copyright 2016 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 MIRTK_ConformalSurfaceFlattening_H
21 #define MIRTK_ConformalSurfaceFlattening_H
22 
23 #include "mirtk/SphericalSurfaceMapper.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Computes discrete conformal map of (closed) surface to the complex plane
31  *
32  * The conformal map is the solution of a sparse system of linear equations,
33  * where the edge weights are identical to those used by Pinkall and Polthier
34  * (1993) and later Eck et al. (1995). These cotangent weights are well known
35  * in the finite element method (FEM) literature and correspond to a
36  * discretization of the Laplace operator. The main difference of the
37  * method by Angenent et al. (1999-2000) and Haker et al. (2000) compared to
38  * the discrete conformal mapping of Eck et al. (1995) and Desbrun et al. (2002)
39  * are the boundary constraints. While all these methods minimize the discrete
40  * Dirichlet energy, the latter methods fix the boundary values of a non-closed
41  * surface, whereas the method by Angenent and Haker is designed for closed
42  * genus-0 surface meshes with a subsequent inverse stereographic projection
43  * to the sphere. The intermediate parametric domain is a triangular subdomain
44  * of the complex plane.
45  *
46  * \note This implementation is based on the corresponding ITK implementation
47  * originally contributed to by Gao et al. https://hdl.handle.net/1926/225
48  * which was later extended and integrated into ITK version 4 as
49  * https://itk.org/Doxygen/html/classitk_1_1ConformalFlatteningMeshFilter.html.
50  *
51  * - Pinkall and Polthier (1993). Computing Discrete Minimal Surfaces and Their Conjugates.
52  * Experiment. Math., 2(1), 15–36.
53  * - Eck et al. (1995). Multiresolution analysis of arbitrary meshes. SIGGRAPH.
54  * - Angenent et al. (1999). Conformal geometry and brain flattening. MICCAI, 271–278.
55  * - Angenent et al. (n.d.). On the Laplace-Beltrami Operator and Brain Surface Flattening.
56  * - Angenent et al. (2000). On Area Preserving Mappings of Minimal Distortion.
57  * In System Theory: Modeling, Analysis and Control, pp. 275–286.
58  * - Haker et al. (2000). Conformal surface parameterization for texture mapping.
59  * IEEE Trans. Vis. Comput. Graphics, 6(2), 181–189.
60  * - Desbrun, Meyer, and Alliez (2002). Intrinsic parameterizations of surface meshes.
61  * Computer Graphics Forum, 21(3), 209–218.
62  */
64 {
65  mirtkObjectMacro(ConformalSurfaceFlattening);
66 
67  // ---------------------------------------------------------------------------
68  // Attributes
69 
70  /// ID of cell containing polar point P used for inverse stereographic projection
71  mirtkPublicAttributeMacro(int, PolarCellId);
72 
73  /// Whether to compose flattening map with inverse stereographic projection
74  mirtkPublicAttributeMacro(bool, MapToSphere);
75 
76  /// Scaling factor applied to complex plane coordinates before projection to sphere
77  mirtkPublicAttributeMacro(double, Scale);
78 
79  /// Radius of sphere to which flattened map is projected
80  mirtkPublicAttributeMacro(double, Radius);
81 
82  /// Maximum number of iterations
83  ///
84  /// When the number of iterations is set to 1, a sparse direct solver is used.
85  mirtkPublicAttributeMacro(int, NumberOfIterations);
86 
87  /// Tolerance for sparse linear solver
88  mirtkPublicAttributeMacro(double, Tolerance);
89 
90  /// Computed map values at surface points
91  mirtkAttributeMacro(vtkSmartPointer<vtkDataArray>, Values);
92 
93  /// Copy attributes of this class from another instance
94  void CopyAttributes(const ConformalSurfaceFlattening &);
95 
96  // ---------------------------------------------------------------------------
97  // Construction/Destruction
98 
99 public:
100 
101  /// Default constructor
103 
104  /// Copy constructor
106 
107  /// Assignment operator
109 
110  /// Destructor
111  virtual ~ConformalSurfaceFlattening();
112 
113  // ---------------------------------------------------------------------------
114  // Execution
115 
116 protected:
117 
118  /// Initialize filter after input and parameters are set
119  virtual void Initialize();
120 
121  /// Construct and solve symmetric system of linear equations
122  virtual void ComputeMap();
123 
124  /// Finalize filter execution
125  virtual void Finalize();
126 
127 };
128 
129 
130 } // namespace mirtk
131 
132 #endif // MIRTK_ConformalSurfaceFlattening_H
virtual void Finalize()
Finalize filter execution.
void Scale(vtkSmartPointer< vtkPointSet > pointset, double)
Scale point set around center.
virtual void Initialize()
Initialize filter after input and parameters are set.
Definition: IOConfig.h:41
ConformalSurfaceFlattening & operator=(const ConformalSurfaceFlattening &)
Assignment operator.
virtual ~ConformalSurfaceFlattening()
Destructor.
virtual void ComputeMap()
Construct and solve symmetric system of linear equations.
ConformalSurfaceFlattening()
Default constructor.