ITK  6.0.0
Insight Toolkit
itkLevelSetNeighborhoodExtractor.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 itkLevelSetNeighborhoodExtractor_h
19 #define itkLevelSetNeighborhoodExtractor_h
20 
21 #include "itkLightProcessObject.h"
22 #include "itkLevelSet.h"
23 #include "itkIndex.h"
24 
25 namespace itk
26 {
56 template <typename TLevelSet>
57 class ITK_TEMPLATE_EXPORT LevelSetNeighborhoodExtractor : public LightProcessObject
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_MOVE(LevelSetNeighborhoodExtractor);
61 
67 
69  itkNewMacro(Self);
70 
72  itkOverrideGetNameOfClassMacro(LevelSetNeighborhoodExtractor);
73 
80  using NodeType = typename LevelSetType::NodeType;
83 
85  static constexpr unsigned int SetDimension = LevelSetType::SetDimension;
86 
89 
91  itkSetConstObjectMacro(InputLevelSet, LevelSetImageType);
92  itkGetConstObjectMacro(InputLevelSet, LevelSetImageType);
96  itkSetMacro(LevelSetValue, double);
97 
99  itkGetConstMacro(LevelSetValue, double);
100 
102  itkSetClampMacro(NarrowBandwidth, double, 0.0, NumericTraits<double>::max());
103 
105  itkGetConstMacro(NarrowBandwidth, double);
106 
108  itkSetMacro(NarrowBanding, bool);
109 
111  itkGetConstMacro(NarrowBanding, bool);
112  itkBooleanMacro(NarrowBanding);
117  void
118  SetInputNarrowBand(NodeContainer * ptr);
119  itkGetModifiableObjectMacro(InputNarrowBand, NodeContainer);
126  {
127  return m_InsidePoints;
128  }
129 
132  NodeContainerPointer
134  {
135  return m_OutsidePoints;
136  }
137 
140  void
141  Locate();
142 
143 protected:
145  ~LevelSetNeighborhoodExtractor() override = default;
146  void
147  PrintSelf(std::ostream & os, Indent indent) const override;
148 
149  typename LevelSetImageType::PixelType
151  {
152  return m_LargeValue;
153  }
154 
155  const NodeType &
156  GetNodeUsedInCalculation(unsigned int idx) const
157  {
158  return m_NodesUsed[idx];
159  }
160 
161  virtual void
162  Initialize();
163 
164  virtual double
165  CalculateDistance(IndexType & index);
166 
167  void
168  GenerateData() override;
169 
170  bool
172  {
173  return m_LastPointIsInside;
174  }
175 
176 private:
177  void
178  GenerateDataFull();
179 
180  void
181  GenerateDataNarrowBand();
182 
183  double m_LevelSetValue{ 0.0 };
184 
185  NodeContainerPointer m_InsidePoints{};
186  NodeContainerPointer m_OutsidePoints{};
187 
188  LevelSetConstPointer m_InputLevelSet{};
189 
190  bool m_NarrowBanding{ false };
191  double m_NarrowBandwidth{ 12.0 };
192  NodeContainerPointer m_InputNarrowBand{};
193 
194  typename LevelSetImageType::RegionType m_ImageRegion{};
195  typename LevelSetImageType::PixelType m_LargeValue{};
196 
197  std::vector<NodeType> m_NodesUsed{};
198 
199  bool m_LastPointIsInside{ false };
200 };
201 } // namespace itk
202 
203 #ifndef ITK_MANUAL_INSTANTIATION
204 # include "itkLevelSetNeighborhoodExtractor.hxx"
205 #endif
206 
207 #endif
itk::LightProcessObject
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Definition: itkLightProcessObject.h:72
itk::LevelSetTypeDefault
Level set type information.
Definition: itkLevelSet.h:40
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:68
itk::detail::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:51
itk::LevelSetNeighborhoodExtractor::LevelSetPointer
typename LevelSetType::LevelSetPointer LevelSetPointer
Definition: itkLevelSetNeighborhoodExtractor.h:77
itk::LevelSetNeighborhoodExtractor::GetLastPointIsInside
bool GetLastPointIsInside() const
Definition: itkLevelSetNeighborhoodExtractor.h:171
itkLightProcessObject.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LevelSetNeighborhoodExtractor::GetNodeUsedInCalculation
const NodeType & GetNodeUsedInCalculation(unsigned int idx) const
Definition: itkLevelSetNeighborhoodExtractor.h:156
itk::LevelSetNode
Represent a node in a level set.
Definition: itkLevelSetNode.h:45
itk::LevelSetNeighborhoodExtractor::NodeContainer
typename LevelSetType::NodeContainer NodeContainer
Definition: itkLevelSetNeighborhoodExtractor.h:81
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LevelSetTypeDefault::LevelSetPointer
typename TLevelSet::Pointer LevelSetPointer
Definition: itkLevelSet.h:51
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::LevelSetNeighborhoodExtractor::LevelSetConstPointer
typename LevelSetType::LevelSetConstPointer LevelSetConstPointer
Definition: itkLevelSetNeighborhoodExtractor.h:78
itk::LevelSetTypeDefault::NodeContainerPointer
typename NodeContainer::Pointer NodeContainerPointer
Definition: itkLevelSet.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LevelSetNeighborhoodExtractor::GetLargeValue
LevelSetImageType::PixelType GetLargeValue() const
Definition: itkLevelSetNeighborhoodExtractor.h:150
itk::LevelSetNeighborhoodExtractor::PixelType
typename LevelSetType::PixelType PixelType
Definition: itkLevelSetNeighborhoodExtractor.h:79
itk::LevelSetTypeDefault::LevelSetConstPointer
typename TLevelSet::ConstPointer LevelSetConstPointer
Definition: itkLevelSet.h:52
itkIndex.h
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::LevelSetTypeDefault::LevelSetImageType
TLevelSet LevelSetImageType
Definition: itkLevelSet.h:45
itk::LevelSetNeighborhoodExtractor::GetOutsidePoints
NodeContainerPointer GetOutsidePoints()
Definition: itkLevelSetNeighborhoodExtractor.h:133
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itkLevelSet.h
itk::LevelSetNeighborhoodExtractor::NodeType
typename LevelSetType::NodeType NodeType
Definition: itkLevelSetNeighborhoodExtractor.h:80
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::LevelSetNeighborhoodExtractor::NodeContainerPointer
typename LevelSetType::NodeContainerPointer NodeContainerPointer
Definition: itkLevelSetNeighborhoodExtractor.h:82
itk::LevelSetTypeDefault::PixelType
typename TLevelSet::PixelType PixelType
Definition: itkLevelSet.h:55
itk::LevelSetNeighborhoodExtractor::GetInsidePoints
NodeContainerPointer GetInsidePoints()
Definition: itkLevelSetNeighborhoodExtractor.h:125
itk::LevelSetNeighborhoodExtractor
Locate pixels of a particular level set.
Definition: itkLevelSetNeighborhoodExtractor.h:57
itk::LevelSetNeighborhoodExtractor::LevelSetImageType
typename LevelSetType::LevelSetImageType LevelSetImageType
Definition: itkLevelSetNeighborhoodExtractor.h:76