ITK  5.4.0
Insight Toolkit
itkImplicitManifoldNormalVectorFilter.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 itkImplicitManifoldNormalVectorFilter_h
19 #define itkImplicitManifoldNormalVectorFilter_h
20 
24 #include "itkVector.h"
25 
26 namespace itk
27 {
72 template <typename TInputImage, typename TSparseOutputImage>
73 class ITK_TEMPLATE_EXPORT ImplicitManifoldNormalVectorFilter
74  : public FiniteDifferenceSparseImageFilter<TInputImage, TSparseOutputImage>
75 {
76 public:
77  ITK_DISALLOW_COPY_AND_MOVE(ImplicitManifoldNormalVectorFilter);
78 
82 
85 
87  itkOverrideGetNameOfClassMacro(ImplicitManifoldNormalVectorFilter);
88 
90  itkNewMacro(Self);
91 
93  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
94 
96  using typename Superclass::InputImageType;
97  using typename Superclass::IndexType;
98  using NormalVectorType = typename Superclass::NodeDataType;
99  using typename Superclass::NodeValueType;
100  using typename Superclass::FiniteDifferenceFunctionType;
101 
102  using typename Superclass::SparseOutputImageType;
103  using NormalBandNodeType = typename Superclass::OutputNodeType;
104  using typename Superclass::NodeListType;
105 
108 
112 
114  using RadiusType = typename FiniteDifferenceFunctionType::RadiusType;
115 
117  void
118  SetNormalFunction(NormalFunctionType * nf);
119 
120  itkSetMacro(MaxIteration, unsigned int);
121  itkGetConstMacro(MaxIteration, unsigned int);
122  itkSetMacro(IsoLevelLow, NodeValueType);
123  itkGetConstMacro(IsoLevelLow, NodeValueType);
124  itkSetMacro(IsoLevelHigh, NodeValueType);
125  itkGetConstMacro(IsoLevelHigh, NodeValueType);
126  itkSetMacro(MinVectorNorm, NodeValueType);
127  itkGetConstMacro(MinVectorNorm, NodeValueType);
128  itkSetMacro(UnsharpMaskingFlag, bool);
129  itkGetConstMacro(UnsharpMaskingFlag, bool);
130  itkSetMacro(UnsharpMaskingWeight, NodeValueType);
131  itkGetConstMacro(UnsharpMaskingWeight, NodeValueType);
132 
133 protected:
135  ~ImplicitManifoldNormalVectorFilter() override = default;
136  void
137  PrintSelf(std::ostream & os, Indent indent) const override;
138 
140  void
141  Initialize() override;
142 
144  void
145  SetNormalBand();
146 
149  void
150  InitializeNormalBandNode(NormalBandNodeType * node, const InputImageIteratorType & it);
151 
154  void
155  CopyInputToOutput() override
156  {}
157 
160  bool
161  Halt() override
162  {
163  if (this->GetElapsedIterations() == m_MaxIteration)
164  {
165  return true;
166  }
167  else
168  {
169  return false;
170  }
171  }
174 protected:
176  NormalVectorType
177  DataConstraint(const NormalVectorType & data) const override
178  {
179  return (data / (m_MinVectorNorm + data.GetNorm()));
180  }
181 
185  void
186  PostProcessOutput() override;
187 
188 private:
190  NormalFunctionType * m_NormalFunction{};
191 
193  unsigned int m_MaxIteration{};
194 
197  NodeValueType m_IsoLevelLow, m_IsoLevelHigh{};
198 
200  NodeValueType m_MinVectorNorm{};
201 
203  bool m_UnsharpMaskingFlag{};
204 
207  NodeValueType m_UnsharpMaskingWeight{};
208 
210  unsigned long m_Indicator[Self::ImageDimension]{};
211  unsigned int m_NumVertex{};
212  NodeValueType m_DimConst{};
213  NodeValueType m_DimConst2{};
214  RadiusType m_ManifoldRadius{};
215 };
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 # include "itkImplicitManifoldNormalVectorFilter.hxx"
220 #endif
221 
222 #endif
itkConstNeighborhoodIterator.h
itkFiniteDifferenceSparseImageFilter.h
itkNormalVectorFunctionBase.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::NormalVectorFunctionBase
This class defines the common functionality for Sparse Image neighborhoods of unit vectors.
Definition: itkNormalVectorFunctionBase.h:52
itk::ImplicitManifoldNormalVectorFilter::NormalVectorType
typename Superclass::NodeDataType NormalVectorType
Definition: itkImplicitManifoldNormalVectorFilter.h:98
itk::ImplicitManifoldNormalVectorFilter::m_IsoLevelLow
NodeValueType m_IsoLevelLow
Definition: itkImplicitManifoldNormalVectorFilter.h:197
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ImplicitManifoldNormalVectorFilter::CopyInputToOutput
void CopyInputToOutput() override
Definition: itkImplicitManifoldNormalVectorFilter.h:155
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itkVector.h
itk::ImplicitManifoldNormalVectorFilter::DataConstraint
NormalVectorType DataConstraint(const NormalVectorType &data) const override
Definition: itkImplicitManifoldNormalVectorFilter.h:177
itk::ImplicitManifoldNormalVectorFilter::NormalBandNodeType
typename Superclass::OutputNodeType NormalBandNodeType
Definition: itkImplicitManifoldNormalVectorFilter.h:103
itk::ImplicitManifoldNormalVectorFilter::Halt
bool Halt() override
Definition: itkImplicitManifoldNormalVectorFilter.h:161
itk::FiniteDifferenceSparseImageFilter
This class implements a multi-threaded base class for Image to SparseImage finite difference processe...
Definition: itkFiniteDifferenceSparseImageFilter.h:64
itk::ImplicitManifoldNormalVectorFilter
This class implements the filter for computing the normal vectors from a scalar implicit function (i....
Definition: itkImplicitManifoldNormalVectorFilter.h:73
itk::ImplicitManifoldNormalVectorFilter::RadiusType
typename FiniteDifferenceFunctionType::RadiusType RadiusType
Definition: itkImplicitManifoldNormalVectorFilter.h:114