TetrahedralMeshMapper.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2015-2016 Imperial College London
5  * Copyright 2015-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_TetrahedralMeshMapper_H
21 #define MIRTK_TetrahedralMeshMapper_H
22 
23 #include "mirtk/VolumeMapper.h"
24 
25 #include "vtkSmartPointer.h"
26 #include "vtkPointSet.h"
27 #include "vtkDataArray.h"
28 
29 
30 namespace mirtk {
31 
32 
33 /**
34  * Base class of volumetric map FEM solvers using tetrahedral elements
35  *
36  * Solvers of this type use a discretization of the volume for which a volumetric
37  * map is computed based on tetrahedral elements.
38  */
40 {
41  mirtkAbstractMacro(TetrahedralMeshMapper);
42 
43  // ---------------------------------------------------------------------------
44  // Attributes
45 
46 protected:
47 
48  /// Boolean array indicating which points are on the boundary, i.e., fixed
49  mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataArray>, InputMask);
50 
51  /// Discretized input domain, i.e., tetrahedral mesh
52  mirtkReadOnlyAttributeMacro(vtkSmartPointer<vtkPointSet>, Volume);
53 
54  /// Output coordinates of volume mesh points
55  mirtkReadOnlyAttributeMacro(vtkSmartPointer<vtkDataArray>, Coords);
56 
57  /// Boolean array indicating which points are on the boundary, i.e., fixed
58  mirtkReadOnlyAttributeMacro(vtkSmartPointer<vtkDataArray>, BoundaryMask);
59 
60  /// Number of points
62 
63  /// Number of boundary points
64  mirtkReadOnlyAttributeMacro(int, NumberOfBoundaryPoints);
65 
66  /// Number of interior points
67  mirtkReadOnlyAttributeMacro(int, NumberOfInteriorPoints);
68 
69  /// Copy attributes of this class from another instance
71 
72  // ---------------------------------------------------------------------------
73  // Construction/Destruction
74 
75 protected:
76 
77  /// Default constructor
79 
80  /// Copy constructor
82 
83  /// Assignment operator
85 
86 public:
87 
88  /// Destructor
89  virtual ~TetrahedralMeshMapper();
90 
91  // ---------------------------------------------------------------------------
92  // Auxiliaries
93 
94  /// Whether a given point is on the boundary
95  bool IsBoundaryPoint(vtkIdType) const;
96 
97  // ---------------------------------------------------------------------------
98  // Execution
99 
100 protected:
101 
102  /// Initialize filter after input and parameters are set
103  virtual void Initialize();
104 
105  /// Finalize filter execution
106  virtual void Finalize();
107 
108 };
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 // Inline definitions
112 ////////////////////////////////////////////////////////////////////////////////
113 
114 // -----------------------------------------------------------------------------
115 inline bool TetrahedralMeshMapper::IsBoundaryPoint(vtkIdType ptId) const
116 {
117  return (_BoundaryMask->GetComponent(ptId, 0) != .0);
118 }
119 
120 
121 } // namespace mirtk
122 
123 #endif // MIRTK_TetrahedralMeshMapper_H
virtual void Initialize()
Initialize filter after input and parameters are set.
TetrahedralMeshMapper & operator=(const TetrahedralMeshMapper &)
Assignment operator.
double Volume(vtkSmartPointer< vtkPolyData >)
Get approximate volume enclosed by polygonal mesh.
Definition: IOConfig.h:41
mirtkPublicAttributeMacro(vtkSmartPointer< vtkDataArray >, InputMask)
Boolean array indicating which points are on the boundary, i.e., fixed.
TetrahedralMeshMapper()
Default constructor.
void CopyAttributes(const TetrahedralMeshMapper &)
Copy attributes of this class from another instance.
mirtkReadOnlyAttributeMacro(vtkSmartPointer< vtkPointSet >, Volume)
Discretized input domain, i.e., tetrahedral mesh.
int NumberOfPoints(vtkDataSet *)
Number of points.
virtual ~TetrahedralMeshMapper()
Destructor.
bool IsBoundaryPoint(vtkIdType) const
Whether a given point is on the boundary.
virtual void Finalize()
Finalize filter execution.