ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetEquationTermBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 "itksys/hash_set.hxx"
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_ASSIGN(LevelSetEquationTermBase);
54 
58  using Superclass = Object;
59 
61  itkTypeMacro( LevelSetEquationTermBase, Object );
62 
63  using InputImageType = TInputImage;
64  using InputImagePointer = typename InputImageType::Pointer;
65  using InputPixelType = typename InputImageType::PixelType;
67 
69  using LevelSetContainerType = TLevelSetContainer;
70  using LevelSetIdentifierType = typename LevelSetContainerType::LevelSetIdentifierType;
71  using LevelSetContainerPointer = typename LevelSetContainerType::Pointer;
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 
86 // using HeavisidePointer = typename HeavisideType::Pointer;
88 
90  itkSetObjectMacro( Input, InputImageType );
91  itkGetModifiableObjectMacro(Input, InputImageType );
93 
94  itkSetMacro( Coefficient, LevelSetOutputRealType );
95  itkGetMacro( Coefficient, LevelSetOutputRealType );
96 
97  itkSetMacro( CurrentLevelSetId, LevelSetIdentifierType );
98  itkGetMacro( CurrentLevelSetId, LevelSetIdentifierType );
99 
100  itkGetModifiableObjectMacro(CurrentLevelSetPointer, LevelSetType );
101 
102  virtual void SetLevelSetContainer( LevelSetContainerType*ptr );
103  itkGetModifiableObjectMacro(LevelSetContainer, LevelSetContainerType );
104 
108  virtual LevelSetOutputRealType Evaluate( const LevelSetInputIndexType& iP );
109 
110  virtual LevelSetOutputRealType Evaluate( const LevelSetInputIndexType& iP,
111  const LevelSetDataType& iData );
112 
114  virtual void Initialize( const LevelSetInputIndexType& iP ) = 0;
115 
117  virtual void InitializeParameters() = 0;
118 
120  virtual void UpdatePixel( const LevelSetInputIndexType& iP,
121  const LevelSetOutputRealType & oldValue,
122  const LevelSetOutputRealType & newValue ) = 0;
123 
125  itkGetConstMacro( CFLContribution, LevelSetOutputRealType );
126 
128  itkSetStringMacro( TermName );
129  itkGetStringMacro( TermName );
131 
133  virtual void Update() = 0;
134 
135  using RequiredDataType = itksys::hash_set< std::string >;
136 
137  const RequiredDataType & GetRequiredData() const;
138 
139 protected:
142 
144  ~LevelSetEquationTermBase() override = default;
145 
146  void SetUp();
147 
152  virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP ) = 0;
153 
154  virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP,
155  const LevelSetDataType& iData ) = 0;
156 
159 
162 
165 
167 
170 
175 
180 
184  std::string m_TermName;
185 
187 };
188 }
189 
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "itkLevelSetEquationTermBase.hxx"
192 #endif
193 
194 #endif
typename LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType
typename LevelSetContainerType::InputIndexType LevelSetInputIndexType
Light weight base class for most itk classes.
typename LevelSetContainerType::LevelSetDataType LevelSetDataType
typename LevelSetContainerType::CacheImageType CacheImageType
Define numeric traits for std::vector.
typename LevelSetContainerType::OutputRealType LevelSetOutputRealType
typename NumericTraits< InputPixelType >::RealType InputPixelRealType
LevelSetContainerPointer m_LevelSetContainer
typename LevelSetContainerType::OutputType LevelSetOutputPixelType
Abstract class to represents a term in the level-set evolution PDE.
typename LevelSetContainerType::GradientType LevelSetGradientType
typename LevelSetContainerType::LevelSetPointer LevelSetPointer
Container of Level-Sets.
typename LevelSetContainerType::HessianType LevelSetHessianType
typename LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType
Base class for most ITK classes.
Definition: itkObject.h:60
Base class of the Heaviside function.