ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkSparseFieldFourthOrderLevelSetImageFilter.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 itkSparseFieldFourthOrderLevelSetImageFilter_h
19#define itkSparseFieldFourthOrderLevelSetImageFilter_h
20
25#include <cmath>
26
27namespace itk
28{
37template <typename TImageType>
38class ITK_TEMPLATE_EXPORT NormalBandNode
39{
40public:
41
43 using LevelSetImageType = TImageType;
44
46 using NodeValueType = typename LevelSetImageType::PixelType;
47
49 using IndexType = typename LevelSetImageType::IndexType;
50
53
56
59
62
65 NodeDataType m_ManifoldNormal[TImageType::ImageDimension];
66
68 NodeDataType m_Flux[TImageType::ImageDimension];
69
73
77
80
84};
85
153template <typename TInputImage, typename TOutputImage>
155 : public SparseFieldLevelSetImageFilter<TInputImage, TOutputImage>
156{
157public:
158 ITK_DISALLOW_COPY_AND_MOVE(SparseFieldFourthOrderLevelSetImageFilter);
160
166
168 itkOverrideGetNameOfClassMacro(SparseFieldFourthOrderLevelSetImageFilter);
169
171 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
172
174 using typename Superclass::OutputImageType;
175 using typename Superclass::ValueType;
176 using typename Superclass::IndexType;
177 using typename Superclass::LayerType;
178 using typename Superclass::RadiusType;
180
184
187
190
193
196
199
201 // using RadiusType = typename NormalVectorFunctionType::RadiusType;
202
205
206 itkGetConstReferenceMacro(MaxRefitIteration, unsigned int);
207 itkSetMacro(MaxRefitIteration, unsigned int);
208 itkGetConstReferenceMacro(MaxNormalIteration, unsigned int);
209 itkSetMacro(MaxNormalIteration, unsigned int);
210 itkGetConstReferenceMacro(CurvatureBandWidth, ValueType);
211 itkSetMacro(CurvatureBandWidth, ValueType);
212 itkGetConstReferenceMacro(RMSChangeNormalProcessTrigger, ValueType);
213 itkSetMacro(RMSChangeNormalProcessTrigger, ValueType);
214 itkGetConstReferenceMacro(NormalProcessType, int);
215 itkSetMacro(NormalProcessType, int);
216 itkGetConstReferenceMacro(NormalProcessConductance, ValueType);
217 itkSetMacro(NormalProcessConductance, ValueType);
218 itkSetMacro(NormalProcessUnsharpFlag, bool);
219 itkGetConstReferenceMacro(NormalProcessUnsharpFlag, bool);
220 itkBooleanMacro(NormalProcessUnsharpFlag);
221 itkSetMacro(NormalProcessUnsharpWeight, ValueType);
222 itkGetConstReferenceMacro(NormalProcessUnsharpWeight, ValueType);
223
226 void
228
232 unsigned int
234 {
235 return static_cast<int>(std::ceil(m_CurvatureBandWidth + Self::ImageDimension));
236 }
237
240 void
241 SetNumberOfLayers(const unsigned int n) override
242 {
243 const unsigned int nm = std::max(this->GetMinimumNumberOfLayers(), n);
244
245 if (nm != this->GetNumberOfLayers())
246 {
248 this->Modified();
249 }
250 }
251
254 void
256 {
258 const ValueType rmschange = this->GetRMSChange();
260
261 if ((this->GetElapsedIterations() == 0) || (m_RefitIteration == m_MaxRefitIteration) ||
262 (rmschange <= m_RMSChangeNormalProcessTrigger) || (this->ActiveLayerCheckBand()))
263 {
264 if ((this->GetElapsedIterations() != 0) && (rmschange <= m_RMSChangeNormalProcessTrigger) &&
265 (m_RefitIteration <= 1))
266 {
267 m_ConvergenceFlag = true;
268 }
269
272 }
273
275 }
276
277 itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits<ValueType>));
278
279protected:
282 void
283 PrintSelf(std::ostream & os, Indent indent) const override;
284
289
293 void
294 ComputeCurvatureTarget(const OutputImageType * distanceImage, SparseImageType * sparseImage) const;
295
297 void
299
304 bool
306
307private:
310 unsigned int m_RefitIteration{};
311
315 unsigned int m_MaxRefitIteration{};
316
319 unsigned int m_MaxNormalIteration{};
320
325
329
333
339
343
347
351
355
358 static const ValueType m_DimConst;
359};
360} // end namespace itk
361
362#ifndef ITK_MANUAL_INSTANTIATION
363# include "itkSparseFieldFourthOrderLevelSetImageFilter.hxx"
364#endif
365
366#endif
virtual const double & GetRMSChange() const
virtual const IdentifierType & GetElapsedIterations() const
This class implements the filter for computing the normal vectors from a scalar implicit function (i....
Control indentation during Print() invocation.
Definition itkIndent.h:50
This class extends the LevelSetFunction class by adding a grow term based on a target curvature store...
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
This is a data storage class that can is used as the node type for the SparseImage class.
Vector< NodeValueType, TImageType::ImageDimension > NodeDataType
NodeDataType m_ManifoldNormal[OutputImageType::ImageDimension]
typename LevelSetImageType::PixelType NodeValueType
typename LevelSetImageType::IndexType IndexType
This class defines all the necessary functionality for performing isotropic and anisotropic diffusion...
virtual void Modified() const
Implements transparent reference counting.
void PrintSelf(std::ostream &os, Indent indent) const override
~SparseFieldFourthOrderLevelSetImageFilter() override=default
void SetLevelSetFunction(LevelSetFunctionType *lsf)
ValueType ComputeCurvatureFromSparseImageNeighborhood(SparseImageIteratorType &it) const
SparseFieldLevelSetImageFilter< TInputImage, TOutputImage > Superclass
ImplicitManifoldNormalVectorFilter< OutputImageType, SparseImageType > NormalVectorFilterType
void ComputeCurvatureTarget(const OutputImageType *distanceImage, SparseImageType *sparseImage) const
LevelSetFunctionWithRefitTerm< OutputImageType, SparseImageType > LevelSetFunctionType
NormalVectorDiffusionFunction< SparseImageType > NormalVectorFunctionType
virtual void SetNumberOfLayers(unsigned int _arg)
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
virtual unsigned int GetNumberOfLayers() const
typename FiniteDifferenceFunctionType::RadiusType RadiusType
A storage type for sparse image data.
A templated class holding a n-Dimensional vector.
Definition itkVector.h:63
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86