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::watershed
29{
75template <typename TScalar>
76class ITK_TEMPLATE_EXPORT SegmentTreeGenerator : public ProcessObject
77{
78public:
79 ITK_DISALLOW_COPY_AND_MOVE(SegmentTreeGenerator);
80
86
89 itkNewMacro(Self);
90 itkOverrideGetNameOfClassMacro(SegmentTreeGenerator);
93 using ScalarType = TScalar;
99
104
108 {
109 return static_cast<SegmentTableType *>(this->ProcessObject::GetInput(0));
110 }
111
112 void
114 {
115 // Reset the highest calculated flood level if we are given a
116 // different input image.
117 if (st != this->GetInput(0))
118 {
120 }
121 this->ProcessObject::SetNthInput(0, st);
122 }
123
127 void
132
133 EquivalencyTableType *
135 {
136 return static_cast<EquivalencyTableType *>(this->ProcessObject::GetInput(1));
137 }
138
140 SegmentTreeType *
142 {
143 return static_cast<SegmentTreeType *>(this->ProcessObject::GetOutput(0));
144 }
145
147 void
148 GenerateData() override;
149
155 itkSetMacro(Merge, bool);
156 itkGetConstMacro(Merge, bool);
163 void
165
166 itkGetConstMacro(FloodLevel, double);
167
172 itkSetMacro(HighestCalculatedFloodLevel, double);
173 itkGetConstMacro(HighestCalculatedFloodLevel, double);
181 itkSetMacro(ConsumeInput, bool);
182 itkGetConstMacro(ConsumeInput, bool);
186 static void
188
191 static void
194 const IdentifierType,
195 const IdentifierType,
196 ScalarType);
197
203
204protected:
206 ~SegmentTreeGenerator() override = default;
207
208 void
209 PrintSelf(std::ostream & os, Indent indent) const override;
210
214
218
219 void
221
223 void
224 GenerateOutputRequestedRegion(DataObject * itkNotUsed(output)) override
225 {}
226
227 void
229
230private:
231 bool m_Merge{ false };
232 double m_FloodLevel{ 0.0 };
233 bool m_ConsumeInput{ false };
234
235 using HashMapType = std::unordered_map<IdentifierType, bool>;
236
238
244};
245} // namespace itk::watershed
246
247#ifndef ITK_MANUAL_INSTANTIATION
248# include "itkWatershedSegmentTreeGenerator.hxx"
249#endif
250
251#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
SizeValueType IdentifierType
Definition itkIntTypes.h:90