ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkFastMarchingBase.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
19#ifndef itkFastMarchingBase_h
20#define itkFastMarchingBase_h
21
22#include "itkIntTypes.h"
25#include "ITKFastMarchingExport.h"
26
27#include <queue>
28#include <functional>
29
30namespace itk
31{
37{
38public:
39
44 enum class TopologyCheck : uint8_t
45 {
49 };
50};
51// Define how to print enumeration
52extern ITKFastMarching_EXPORT std::ostream &
53 operator<<(std::ostream & out, const FastMarchingTraitsEnums::TopologyCheck value);
54
120template <typename TInput, typename TOutput>
121class ITK_TEMPLATE_EXPORT FastMarchingBase : public FastMarchingTraits<TInput, TOutput>::SuperclassType
122{
123public:
124 ITK_DISALLOW_COPY_AND_MOVE(FastMarchingBase);
125
127 using SuperclassType = typename Traits::SuperclassType;
128
130 using Superclass = typename FastMarchingTraits<TInput, TOutput>::SuperclassType;
133
135 itkOverrideGetNameOfClassMacro(FastMarchingBase);
136
138 using InputDomainType = typename Traits::InputDomainType;
139 using InputDomainPointer = typename Traits::InputDomainPointer;
140 using InputPixelType = typename Traits::InputPixelType;
141
143 using OutputDomainType = typename Traits::OutputDomainType;
144 using OutputDomainPointer = typename Traits::OutputDomainPointer;
145 using OutputPixelType = typename Traits::OutputPixelType;
146
148 using NodeType = typename Traits::NodeType;
149
151 using NodePairType = typename Traits::NodePairType;
152 using NodePairContainerType = typename Traits::NodePairContainerType;
153 using NodePairContainerPointer = typename Traits::NodePairContainerPointer;
154 using NodePairContainerConstIterator = typename Traits::NodePairContainerConstIterator;
155
156 using LabelType = typename Traits::LabelType;
157
159 using StoppingCriterionType = FastMarchingStoppingCriterionBase<TInput, TOutput>;
160 using StoppingCriterionPointer = typename StoppingCriterionType::Pointer;
161
162 /*
163 using ElementIdentifier = long;
164
165 using PriorityQueueElementType = MinPriorityQueueElementWrapper< NodeType,
166 OutputPixelType,
167 ElementIdentifier >;
168
169 using PriorityQueueType = PriorityQueueContainer< PriorityQueueElementType,
170 PriorityQueueElementType, OutputPixelType, ElementIdentifier >;
171 using PriorityQueuePointer = typename PriorityQueueType::Pointer;
172 */
173
175#if !defined(ITK_LEGACY_REMOVE)
176 using TopologyCheckType = FastMarchingTraitsEnums::TopologyCheck;
178 static constexpr TopologyCheckEnum Nothing = TopologyCheckEnum::Nothing;
179 static constexpr TopologyCheckEnum NoHandles = TopologyCheckEnum::NoHandles;
180 static constexpr TopologyCheckEnum Strict = TopologyCheckEnum::Strict;
181#endif
182
186 itkGetConstReferenceMacro(TopologyCheck, TopologyCheckEnum);
188
190 itkSetObjectMacro(TrialPoints, NodePairContainerType);
191 itkGetModifiableObjectMacro(TrialPoints, NodePairContainerType);
193
195 itkSetObjectMacro(AlivePoints, NodePairContainerType);
196 itkGetModifiableObjectMacro(AlivePoints, NodePairContainerType);
198
200 itkSetObjectMacro(ProcessedPoints, NodePairContainerType);
201 itkGetModifiableObjectMacro(ProcessedPoints, NodePairContainerType);
203
205 itkSetObjectMacro(ForbiddenPoints, NodePairContainerType);
206 itkGetModifiableObjectMacro(ForbiddenPoints, NodePairContainerType);
208
210 itkSetObjectMacro(StoppingCriterion, StoppingCriterionType);
211 itkGetModifiableObjectMacro(StoppingCriterion, StoppingCriterionType);
212
214 itkGetMacro(SpeedConstant, double);
215 itkSetMacro(SpeedConstant, double);
216
218 itkGetMacro(NormalizationFactor, double);
219 itkSetMacro(NormalizationFactor, double);
220
222 itkGetMacro(TargetReachedValue, OutputPixelType);
223
228 itkSetMacro(CollectPoints, bool);
229
231 itkGetConstReferenceMacro(CollectPoints, bool);
232 itkBooleanMacro(CollectPoints);
234
235protected:
238
240 ~FastMarchingBase() override = default;
241
243
247
251
256
258
259 // PriorityQueuePointer m_Heap;
260 using HeapContainerType = std::vector<NodePairType>;
261 using NodeComparerType = std::greater<NodePairType>;
262
263 using PriorityQueueType = std::priority_queue<NodePairType, HeapContainerType, NodeComparerType>;
264
266
268
270 virtual IdentifierType
272
274 virtual const OutputPixelType
275 GetOutputValue(OutputDomainType * oDomain, const NodeType & iNode) const = 0;
276
278 virtual void
279 SetOutputValue(OutputDomainType * oDomain, const NodeType & iNode, const OutputPixelType & iValue) = 0;
280
284 virtual unsigned char
285 GetLabelValueForGivenNode(const NodeType & iNode) const = 0;
286
290 virtual void
291 SetLabelValueForGivenNode(const NodeType & iNode, const LabelType & iLabel) = 0;
292
297 virtual void
298 UpdateNeighbors(OutputDomainType * oDomain, const NodeType & iNode) = 0;
299
304 virtual void
305 UpdateValue(OutputDomainType * oDomain, const NodeType & iNode) = 0;
306
311 virtual bool
312 CheckTopology(OutputDomainType * oDomain, const NodeType & iNode) = 0;
313
315 void
317
319 virtual void
321
323 void
324 GenerateData() override;
325
327 void
328 PrintSelf(std::ostream & os, Indent indent) const override;
329};
330} // namespace itk
331
332#ifndef ITK_MANUAL_INSTANTIATION
333# include "itkFastMarchingBase.hxx"
334#endif
335
336#endif
OutputPixelType m_TargetReachedValue
FastMarchingTraits< TInput, TOutput > Traits
void Initialize(OutputDomainType *oDomain)
NodePairContainerPointer m_ProcessedPoints
virtual void SetLabelValueForGivenNode(const NodeType &iNode, const LabelType &iLabel)=0
Set the Label Value for a given node.
typename StoppingCriterionType::Pointer StoppingCriterionPointer
virtual const OutputPixelType GetOutputValue(OutputDomainType *oDomain, const NodeType &iNode) const =0
Get the output value (front value) for a given node.
virtual unsigned char GetLabelValueForGivenNode(const NodeType &iNode) const =0
Get the LabelEnum Value for a given node.
TopologyCheckEnum m_TopologyCheck
typename Traits::SuperclassType SuperclassType
virtual IdentifierType GetTotalNumberOfNodes() const =0
Get the total number of nodes in the domain.
typename Traits::InputPixelType InputPixelType
typename Traits::OutputDomainPointer OutputDomainPointer
NodePairContainerPointer m_ForbiddenPoints
typename FastMarchingTraits< TInput, TOutput >::SuperclassType Superclass
typename Traits::NodePairContainerType NodePairContainerType
typename Traits::InputDomainType InputDomainType
void GenerateData() override
std::vector< NodePairType > HeapContainerType
void PrintSelf(std::ostream &os, Indent indent) const override
PrintSelf method.
virtual bool CheckTopology(OutputDomainType *oDomain, const NodeType &iNode)=0
Check if the current node violate topological criterion.
typename Traits::OutputDomainType OutputDomainType
virtual void UpdateValue(OutputDomainType *oDomain, const NodeType &iNode)=0
Update value for a given node.
typename Traits::NodePairContainerPointer NodePairContainerPointer
typename Traits::NodeType NodeType
SmartPointer< const Self > ConstPointer
virtual void InitializeOutput(OutputDomainType *oDomain)=0
typename Traits::InputDomainPointer InputDomainPointer
OutputPixelType m_TopologyValue
typename Traits::NodePairType NodePairType
~FastMarchingBase() override=default
Destructor.
FastMarchingTraitsEnums::TopologyCheck TopologyCheckEnum
virtual void SetOutputValue(OutputDomainType *oDomain, const NodeType &iNode, const OutputPixelType &iValue)=0
Set the output value (front value) for a given node.
std::priority_queue< NodePairType, HeapContainerType, NodeComparerType > PriorityQueueType
std::greater< NodePairType > NodeComparerType
virtual void UpdateNeighbors(OutputDomainType *oDomain, const NodeType &iNode)=0
Update neighbors to a given node.
NodePairContainerPointer m_TrialPoints
SmartPointer< Self > Pointer
FastMarchingStoppingCriterionBase< TInput, TOutput > StoppingCriterionType
StoppingCriterionPointer m_StoppingCriterion
NodePairContainerPointer m_AlivePoints
FastMarchingBase()
Constructor.
typename Traits::OutputPixelType OutputPixelType
typename Traits::LabelType LabelType
typename Traits::NodePairContainerConstIterator NodePairContainerConstIterator
Base class traits to be used by the FastMarchingBase.
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition itkIntTypes.h:90
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)