ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkSparseFieldLevelSetImageFilter.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 itkSparseFieldLevelSetImageFilter_h
19#define itkSparseFieldLevelSetImageFilter_h
20
23#include "itkSparseFieldLayer.h"
24#include "itkObjectStore.h"
25#include <vector>
27
28namespace itk
29{
35template <typename TValue>
43
72template <typename TNeighborhoodType>
73class ITK_TEMPLATE_EXPORT SparseFieldCityBlockNeighborList
74{
75public:
76 using NeighborhoodType = TNeighborhoodType;
77 using OffsetType = typename NeighborhoodType::OffsetType;
78 using RadiusType = typename NeighborhoodType::RadiusType;
79 static constexpr unsigned int Dimension = NeighborhoodType::Dimension;
80
81 const RadiusType &
82 GetRadius() const
83 {
84 return m_Radius;
85 }
86
87 const unsigned int &
88 GetArrayIndex(unsigned int i) const
89 {
90 return m_ArrayIndex[i];
91 }
92
93 const OffsetType &
94 GetNeighborhoodOffset(unsigned int i) const
95 {
96 return m_NeighborhoodOffset[i];
97 }
98
99 const unsigned int &
100 GetSize() const
101 {
102 return m_Size;
103 }
104
105 int
106 GetStride(unsigned int i)
107 {
108 return m_StrideTable[i];
109 }
110
113
114 void
115 Print(std::ostream & os, Indent indent) const;
116
117private:
118 unsigned int m_Size;
120 std::vector<unsigned int> m_ArrayIndex;
121 std::vector<OffsetType> m_NeighborhoodOffset;
122
126};
127
238template <typename TInputImage, typename TOutputImage>
239class ITK_TEMPLATE_EXPORT SparseFieldLevelSetImageFilter : public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
240{
241public:
242 ITK_DISALLOW_COPY_AND_MOVE(SparseFieldLevelSetImageFilter);
243
249
251 using typename Superclass::TimeStepType;
252 using typename Superclass::RadiusType;
254
256 itkNewMacro(Self);
257
259 itkOverrideGetNameOfClassMacro(SparseFieldLevelSetImageFilter);
260
262 using InputImageType = TInputImage;
263 using OutputImageType = TOutputImage;
264 using IndexType = typename OutputImageType::IndexType;
265 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
266
269 using ValueType = typename OutputImageType::ValueType;
270
273
277
279 using LayerListType = std::vector<LayerPointerType>;
280
282 using StatusType = signed char;
283
287
291
293 using UpdateBufferType = std::vector<ValueType>;
294
298 itkSetMacro(NumberOfLayers, unsigned int);
299 itkGetConstMacro(NumberOfLayers, unsigned int);
301
303 itkSetMacro(IsoSurfaceValue, ValueType);
304 itkGetConstMacro(IsoSurfaceValue, ValueType);
306
310 // itkGetConstMacro(RMSChange, ValueType);
311
317 itkSetMacro(InterpolateSurfaceLocation, bool);
318 itkGetConstMacro(InterpolateSurfaceLocation, bool);
320
322 void
327 void
332
333
337
338protected:
341 void
342 PrintSelf(std::ostream & os, Indent indent) const override;
343
348 inline virtual ValueType
349 CalculateUpdateValue(const IndexType & itkNotUsed(idx),
350 const TimeStepType & dt,
351 const ValueType & value,
352 const ValueType & change)
353 {
354 return (value + dt * change);
355 }
356
360 void
362
367 virtual void
369
371 void
372 Initialize() override;
373
378 void
380
382 void
384
387 void
388 ApplyUpdate(const TimeStepType & dt) override;
389
393 CalculateChange() override;
394
398 void
400
405 void
407
409 void
411
419 void
420 PropagateLayerValues(StatusType from, StatusType to, StatusType promote, int InOrOut);
421
426 void
428
432 void
434
436 void
438 LayerType * OutputList,
439 StatusType ChangeToStatus,
440 StatusType SearchForStatus);
441
443 void
444 ProcessOutsideList(LayerType * OutsideList, StatusType ChangeToStatus);
445
446 itkGetConstMacro(ValueZero, ValueType);
447 itkGetConstMacro(ValueOne, ValueType);
448
451
455
458
461
465
469
473
477
481
485 typename OutputImageType::Pointer m_ShiftedImage{};
486
492
497 unsigned int m_NumberOfLayers{ 2 };
498
501
504
507
511
515 // ValueType m_RMSChange;
516
522
525
526private:
530};
531} // end namespace itk
532
533#ifndef ITK_MANUAL_INSTANTIATION
534# include "itkSparseFieldLevelSetImageFilter.hxx"
535#endif
536
537#endif
static constexpr DimensionValueType Dimension
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
typename FiniteDifferenceFunctionType::RadiusType RadiusType
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:50
A specialized memory management object for allocating and destroying contiguous blocks of objects.
Implements transparent reference counting.
A convenience class for storing indices which reference neighbor pixels within a neighborhood.
typename NeighborhoodType::RadiusType RadiusType
const OffsetType & GetNeighborhoodOffset(unsigned int i) const
typename NeighborhoodType::OffsetType OffsetType
void Print(std::ostream &os, Indent indent) const
const unsigned int & GetArrayIndex(unsigned int i) const
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver.
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
void PrintSelf(std::ostream &os, Indent indent) const override
void ApplyUpdate(const TimeStepType &dt) override
~SparseFieldLevelSetImageFilter() override=default
void ConstructLayer(StatusType from, StatusType to)
void ProcessStatusList(LayerType *InputList, LayerType *OutputList, StatusType ChangeToStatus, StatusType SearchForStatus)
void PropagateLayerValues(StatusType from, StatusType to, StatusType promote, int InOrOut)
virtual ValueType CalculateUpdateValue(const IndexType &idx, const TimeStepType &dt, const ValueType &value, const ValueType &change)
FiniteDifferenceImageFilter< TInputImage, OutputImageType > Superclass
TimeStepType CalculateChange() override
void UpdateActiveLayerValues(TimeStepType dt, LayerType *UpList, LayerType *DownList)
void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus)
SparseFieldCityBlockNeighborList< NeighborhoodIterator< OutputImageType > > m_NeighborList
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....