ITK  6.0.0
Insight Toolkit
itkLevelSetEquationTermBase.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 itkLevelSetEquationTermBase_h
20 #define itkLevelSetEquationTermBase_h
21 
22 #include "itkObject.h"
24 #include <unordered_set>
25 
26 namespace itk
27 {
47 template <typename TInputImage, // Input image
48  typename TLevelSetContainer>
49 class ITK_TEMPLATE_EXPORT LevelSetEquationTermBase : public Object
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(LevelSetEquationTermBase);
58  using Superclass = Object;
59 
61  itkOverrideGetNameOfClassMacro(LevelSetEquationTermBase);
62 
63  using InputImageType = TInputImage;
65  using InputPixelType = typename InputImageType::PixelType;
67 
69  using LevelSetContainerType = TLevelSetContainer;
70  using LevelSetIdentifierType = typename LevelSetContainerType::LevelSetIdentifierType;
72  using LevelSetType = typename LevelSetContainerType::LevelSetType;
73  using LevelSetPointer = typename LevelSetContainerType::LevelSetPointer;
74  using LevelSetOutputPixelType = typename LevelSetContainerType::OutputType;
75  using LevelSetOutputRealType = typename LevelSetContainerType::OutputRealType;
76  using LevelSetInputIndexType = typename LevelSetContainerType::InputIndexType;
77  using LevelSetGradientType = typename LevelSetContainerType::GradientType;
78  using LevelSetHessianType = typename LevelSetContainerType::HessianType;
79  using LevelSetDataType = typename LevelSetContainerType::LevelSetDataType;
80 
81  using DomainMapImageFilterType = typename LevelSetContainerType::DomainMapImageFilterType;
82  using CacheImageType = typename LevelSetContainerType::CacheImageType;
83 
85  // using HeavisidePointer = typename HeavisideType::Pointer;
87 
89  itkSetObjectMacro(Input, InputImageType);
90  itkGetModifiableObjectMacro(Input, InputImageType);
93  itkSetMacro(Coefficient, LevelSetOutputRealType);
94  itkGetMacro(Coefficient, LevelSetOutputRealType);
95 
96  itkSetMacro(CurrentLevelSetId, LevelSetIdentifierType);
97  itkGetMacro(CurrentLevelSetId, LevelSetIdentifierType);
98 
99  itkGetModifiableObjectMacro(CurrentLevelSetPointer, LevelSetType);
100 
101  virtual void
102  SetLevelSetContainer(LevelSetContainerType * iContainer);
103  itkGetModifiableObjectMacro(LevelSetContainer, LevelSetContainerType);
104 
108  virtual LevelSetOutputRealType
109  Evaluate(const LevelSetInputIndexType & iP);
110 
111  virtual LevelSetOutputRealType
112  Evaluate(const LevelSetInputIndexType & iP, const LevelSetDataType & iData);
113 
115  virtual void
116  Initialize(const LevelSetInputIndexType & iP) = 0;
117 
119  virtual void
120  InitializeParameters() = 0;
121 
123  virtual void
124  UpdatePixel(const LevelSetInputIndexType & iP,
125  const LevelSetOutputRealType & oldValue,
126  const LevelSetOutputRealType & newValue) = 0;
127 
129  itkGetConstMacro(CFLContribution, LevelSetOutputRealType);
130 
132  itkSetStringMacro(TermName);
133  itkGetStringMacro(TermName);
137  virtual void
138  Update() = 0;
139 
140  using RequiredDataType = std::unordered_set<std::string>;
141 
142  const RequiredDataType &
143  GetRequiredData() const;
144 
145 protected:
148 
150  ~LevelSetEquationTermBase() override = default;
151 
152  void
153  SetUp();
154 
159  virtual LevelSetOutputRealType
160  Value(const LevelSetInputIndexType & iP) = 0;
161 
162  virtual LevelSetOutputRealType
163  Value(const LevelSetInputIndexType & iP, const LevelSetDataType & iData) = 0;
164 
166  InputImagePointer m_Input{};
167 
169  LevelSetContainerPointer m_LevelSetContainer{};
170 
172  LevelSetIdentifierType m_CurrentLevelSetId{};
173 
174  LevelSetPointer m_CurrentLevelSetPointer{};
175 
177  LevelSetOutputRealType m_Coefficient{};
178 
182  LevelSetOutputRealType m_CFLContribution{};
183 
187  HeavisideConstPointer m_Heaviside{};
188 
192  std::string m_TermName{};
193 
194  RequiredDataType m_RequiredData{};
195 };
196 } // namespace itk
197 
198 #ifndef ITK_MANUAL_INSTANTIATION
199 # include "itkLevelSetEquationTermBase.hxx"
200 #endif
201 
202 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::RequiredDataType
std::unordered_set< std::string > RequiredDataType
Definition: itkLevelSetEquationTermBase.h:140
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetIdentifierType
typename LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType
Definition: itkLevelSetEquationTermBase.h:70
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetContainerType
TLevelSetContainer LevelSetContainerType
Definition: itkLevelSetEquationTermBase.h:69
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetHessianType
typename LevelSetContainerType::HessianType LevelSetHessianType
Definition: itkLevelSetEquationTermBase.h:78
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetType
typename LevelSetContainerType::LevelSetType LevelSetType
Definition: itkLevelSetEquationTermBase.h:72
itk::SmartPointer< Self >
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::DomainMapImageFilterType
typename LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType
Definition: itkLevelSetEquationTermBase.h:81
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::HeavisideStepFunctionBase
Base class of the Heaviside function.
Definition: itkHeavisideStepFunctionBase.h:51
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetInputIndexType
typename LevelSetContainerType::InputIndexType LevelSetInputIndexType
Definition: itkLevelSetEquationTermBase.h:76
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::HeavisideConstPointer
typename HeavisideType::ConstPointer HeavisideConstPointer
Definition: itkLevelSetEquationTermBase.h:86
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::InputPixelRealType
typename NumericTraits< InputPixelType >::RealType InputPixelRealType
Definition: itkLevelSetEquationTermBase.h:66
itk::LevelSetContainer
Container of Level-Sets.
Definition: itkLevelSetContainer.h:39
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::CacheImageType
typename LevelSetContainerType::CacheImageType CacheImageType
Definition: itkLevelSetEquationTermBase.h:82
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetOutputPixelType
typename LevelSetContainerType::OutputType LevelSetOutputPixelType
Definition: itkLevelSetEquationTermBase.h:74
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetPointer
typename LevelSetContainerType::LevelSetPointer LevelSetPointer
Definition: itkLevelSetEquationTermBase.h:73
itkObject.h
itk::LevelSetEquationTermBase
Abstract class to represents a term in the level-set evolution PDE.
Definition: itkLevelSetEquationTermBase.h:49
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::InputImageType
TInput InputImageType
Definition: itkLevelSetEquationTermBase.h:63
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetContainerPointer
typename LevelSetContainerType::Pointer LevelSetContainerPointer
Definition: itkLevelSetEquationTermBase.h:71
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetDataType
typename LevelSetContainerType::LevelSetDataType LevelSetDataType
Definition: itkLevelSetEquationTermBase.h:79
itkHeavisideStepFunctionBase.h
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkLevelSetEquationTermBase.h:65
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetGradientType
typename LevelSetContainerType::GradientType LevelSetGradientType
Definition: itkLevelSetEquationTermBase.h:77
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::LevelSetOutputRealType
typename LevelSetContainerType::OutputRealType LevelSetOutputRealType
Definition: itkLevelSetEquationTermBase.h:75
itk::LevelSetEquationTermBase< TInput, TLevelSetContainer >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkLevelSetEquationTermBase.h:64