SurfacePatches.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_SurfacePatches_H
21 #define MIRTK_SurfacePatches_H
22 
23 #include "mirtk/SurfaceFilter.h"
24 
25 #include "mirtk/Array.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * Labels connected surface patches
33  *
34  * Each surface patch consists of interior cells with edges that have only
35  * one cell edge neigbhor. Only boundary cells of a surface patch have
36  * an edge with no or multiple cell edge neigbhors.
37  *
38  * Other definitions of patch borders based on surface attributes may be
39  * considered by specializations (subclasses) of this filter.
40  */
42 {
43  mirtkObjectMacro(SurfacePatches);
44 
45  // ---------------------------------------------------------------------------
46  // Types
47 public:
48 
49  /// Enumeration of possible orderings of surface patches
50  enum Ordering
51  {
52  NoOrdering, ///< No sorting of output patches
53  LargestFirst, ///< Sort by decreasing patch size
54  SmallestFirst ///< Sort by increasing patch size
55  };
56 
57  // ---------------------------------------------------------------------------
58  // Attributes
59 private:
60 
61  /// Ordering of surface patch labels
62  mirtkPublicAttributeMacro(enum Ordering, Ordering);
63 
64  /// Number of surface patches
65  mirtkReadOnlyAttributeMacro(int, NumberOfPatches);
66 
67  /// Sizes of each surface patch in number of cells
68  mirtkReadOnlyAttributeMacro(Array<int>, PatchSize);
69 
70  /// Copy attributes of this class from another instance
71  void CopyAttributes(const SurfacePatches &);
72 
73  // ---------------------------------------------------------------------------
74  // Construction/destruction
75 public:
76 
77  /// Constructor
79 
80  /// Copy constructor
82 
83  /// Assignment operator
85 
86  /// Destructor
87  virtual ~SurfacePatches();
88 
89  // ---------------------------------------------------------------------------
90  // Execution
91 protected:
92 
93  /// Initialize filter after input and parameters are set
94  virtual void Initialize();
95 
96  /// Execute filter
97  virtual void Execute();
98 
99  /// Finalize filter output
100  virtual void Finalize();
101 
102  // ---------------------------------------------------------------------------
103  // Output
104 public:
105 
106  /// Get cell data array storing surface patch labels
107  vtkDataArray *GetLabelsArray() const;
108 };
109 
110 
111 } // namespace mirtk
112 
113 #endif // MIRKT_SurfacePatches_H
virtual void Initialize()
Initialize filter after input and parameters are set.
Definition: IOConfig.h:41
SurfacePatches & operator=(const SurfacePatches &)
Assignment operator.
No sorting of output patches.
virtual ~SurfacePatches()
Destructor.
virtual void Finalize()
Finalize filter output.
SurfacePatches()
Constructor.
Sort by increasing patch size.
vtkDataArray * GetLabelsArray() const
Get cell data array storing surface patch labels.
Sort by decreasing patch size.
Ordering
Enumeration of possible orderings of surface patches.
virtual void Execute()
Execute filter.