ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWatershedSegmentTreeGenerator.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkWatershedSegmentTreeGenerator_h
19#define itkWatershedSegmentTreeGenerator_h
20
23#include "itkEquivalencyTable.h"
24
25#include <algorithm>
26#include <utility>
27
28namespace itk
29{
30namespace watershed
31{
77template <typename TScalar>
78class ITK_TEMPLATE_EXPORT SegmentTreeGenerator : public ProcessObject
79{
80public:
81 ITK_DISALLOW_COPY_AND_MOVE(SegmentTreeGenerator);
82
88
90 itkNewMacro(Self);
91 itkOverrideGetNameOfClassMacro(SegmentTreeGenerator);
93
95 using ScalarType = TScalar;
101
106
110 {
111 return static_cast<SegmentTableType *>(this->ProcessObject::GetInput(0));
112 }
113
114 void
116 {
117 // Reset the highest calculated flood level if we are given a
118 // different input image.
119 if (st != this->GetInput(0))
120 {
122 }
123 this->ProcessObject::SetNthInput(0, st);
124 }
125
129 void
134
135 EquivalencyTableType *
137 {
138 return static_cast<EquivalencyTableType *>(this->ProcessObject::GetInput(1));
139 }
140
142 SegmentTreeType *
144 {
145 return static_cast<SegmentTreeType *>(this->ProcessObject::GetOutput(0));
146 }
147
149 void
150 GenerateData() override;
151
156 itkSetMacro(Merge, bool);
157 itkGetConstMacro(Merge, bool);
159
165 void
167
168 itkGetConstMacro(FloodLevel, double);
169
173 itkSetMacro(HighestCalculatedFloodLevel, double);
174 itkGetConstMacro(HighestCalculatedFloodLevel, double);
176
182 itkSetMacro(ConsumeInput, bool);
183 itkGetConstMacro(ConsumeInput, bool);
185
188 static void
190
193 static void
196 const IdentifierType,
197 const IdentifierType,
198 ScalarType);
199
205
206protected:
208 ~SegmentTreeGenerator() override = default;
209
210 void
211 PrintSelf(std::ostream & os, Indent indent) const override;
212
216
220
221 void
223
225 void
226 GenerateOutputRequestedRegion(DataObject * itkNotUsed(output)) override
227 {}
228
229 void
231
232private:
233 bool m_Merge{ false };
234 double m_FloodLevel{ 0.0 };
235 bool m_ConsumeInput{ false };
236
237 using HashMapType = std::unordered_map<IdentifierType, bool>;
238
240
246};
247} // end namespace watershed
248} // end namespace itk
249
250#ifndef ITK_MANUAL_INSTANTIATION
251# include "itkWatershedSegmentTreeGenerator.hxx"
252#endif
253
254#endif
SmartPointer< Self > Pointer
Hash table to manage integral label equivalencies.
Control indentation during Print() invocation.
Definition itkIndent.h:50
Hash table to manage integral label equivalencies that are order dependent.
DataObject * GetOutput(const DataObjectIdentifierType &key)
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx)
Make a DataObject of the correct type to used as the specified output.
Implements transparent reference counting.
static void MergeSegments(SegmentTableTypePointer, OneWayEquivalencyTableTypePointer, const IdentifierType, const IdentifierType)
void PrintSelf(std::ostream &os, Indent indent) const override
void ExtractMergeHierarchy(SegmentTableTypePointer, SegmentTreeTypePointer)
void GenerateOutputRequestedRegion(DataObject *output) override
~SegmentTreeGenerator() override=default
void GenerateInputRequestedRegion() override
typename SegmentTableType::Pointer SegmentTableTypePointer
OneWayEquivalencyTableType::Pointer m_MergedSegmentsTable
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
std::unordered_map< IdentifierType, bool > HashMapType
typename OneWayEquivalencyTableType::Pointer OneWayEquivalencyTableTypePointer
static void PruneMergeSegments(SegmentTableTypePointer, OneWayEquivalencyTableTypePointer, const IdentifierType, const IdentifierType, ScalarType)
void CompileMergeList(SegmentTableTypePointer, SegmentTreeTypePointer)
typename SegmentTreeType::Pointer SegmentTreeTypePointer
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition itkIntTypes.h:90