ITK  5.4.0
Insight Toolkit
itkFastMarchingStoppingCriterionBase.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 itkFastMarchingStoppingCriterionBase_h
20 #define itkFastMarchingStoppingCriterionBase_h
21 
23 #include "itkNumericTraits.h"
24 #include "itkFastMarchingTraits.h"
25 
26 namespace itk
27 {
28 
35 template <typename TInput, typename TOutput>
36 class FastMarchingStoppingCriterionBase : public StoppingCriterionBase
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_MOVE(FastMarchingStoppingCriterionBase);
40 
41  using Self = FastMarchingStoppingCriterionBase;
42  using Superclass = StoppingCriterionBase;
43  using Pointer = SmartPointer<Self>;
44  using ConstPointer = SmartPointer<const Self>;
45  using Traits = FastMarchingTraits<TInput, TOutput>;
46 
47  using NodeType = typename Traits::NodeType;
48  using OutputPixelType = typename Traits::OutputPixelType;
49  using NodePairType = typename Traits::NodePairType;
50  using OutputDomainType = typename Traits::OutputDomainType;
51  using OutputDomainPointer = typename Traits::OutputDomainPointer;
52 
54  itkOverrideGetNameOfClassMacro(FastMarchingStoppingCriterionBase);
55 
57  void
58  Reinitialize()
59  {
60  m_CurrentValue = OutputPixelType{};
61  m_PreviousValue = OutputPixelType{};
62 
63  this->Reset();
64  }
65 
66  void
67  SetCurrentNodePair(const NodePairType & iNodePair)
68  {
69  this->SetCurrentNode(iNodePair.GetNode());
70  this->SetCurrentValue(iNodePair.GetValue());
71  }
72 
73  itkSetObjectMacro(Domain, OutputDomainType);
74  itkGetModifiableObjectMacro(Domain, OutputDomainType);
75 
76 protected:
78  FastMarchingStoppingCriterionBase()
79  : Superclass()
80  , m_Domain(nullptr)
81  {
82  m_CurrentValue = OutputPixelType{};
83  m_PreviousValue = OutputPixelType{};
84  }
88  ~FastMarchingStoppingCriterionBase() override = default;
89 
90  OutputDomainPointer m_Domain{};
91 
92  OutputPixelType m_PreviousValue{};
93  OutputPixelType m_CurrentValue{};
94 
97  virtual void
98  Reset() = 0;
99 
101  virtual void
102  SetCurrentNode(const NodeType & iNode) = 0;
103 
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itkFastMarchingTraits.h
itkStoppingCriterionBase.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkNumericTraits.h
AddImageFilter
Definition: itkAddImageFilter.h:81
Superclass
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
Definition: itkAddImageFilter.h:90