ITK  5.4.0
Insight Toolkit
itkRegionBasedLevelSetFunctionSharedData.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 itkRegionBasedLevelSetFunctionSharedData_h
19#define itkRegionBasedLevelSetFunctionSharedData_h
20
21#include "itkLightObject.h"
22
23#include "itkVector.h"
24#include "itkListSample.h"
25#include "itkKdTreeGenerator.h"
26
29
30namespace itk
31{
64template <typename TInputImage, typename TFeatureImage, typename TSingleData>
66{
67public:
68 ITK_DISALLOW_COPY_AND_MOVE(RegionBasedLevelSetFunctionSharedData);
69
74
75 static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
76
77 itkOverrideGetNameOfClassMacro(RegionBasedLevelSetFunctionSharedData);
78
79 using InputImageType = TInputImage;
82 using InputPixelType = typename InputImageType::PixelType;
86 using InputSpacingType = typename InputImageType::SpacingType;
90
91 using FeatureImageType = TFeatureImage;
94 using FeaturePixelType = typename FeatureImageType::PixelType;
98 using FeatureSpacingType = typename FeatureImageType::SpacingType;
101
102 using ListPixelType = std::list<unsigned int>;
114
121
122 using LevelSetDataType = TSingleData;
124 using LevelSetDataPointerVector = std::vector<LevelSetDataPointer>;
125 using LevelSetDataPointerVectorIterator = typename LevelSetDataPointerVector::iterator;
126
127 void
128 SetFunctionCount(const unsigned int n)
129 {
130 this->m_FunctionCount = n;
131 this->m_LevelSetDataPointerVector.resize(n, nullptr);
132
133 auto it = m_LevelSetDataPointerVector.begin();
134 auto end = m_LevelSetDataPointerVector.end();
135 while (it != end)
136 {
137 (*it) = LevelSetDataType::New();
138 ++it;
139 }
140 }
141
142 void
143 SetNumberOfNeighbors(const unsigned int n)
144 {
145 this->m_NumberOfNeighbors = n;
146 }
147
148 void
149 CreateHeavisideFunctionOfLevelSetImage(const unsigned int j, const InputImageType * image)
150 {
151 m_LevelSetDataPointerVector[j]->CreateHeavisideFunctionOfLevelSetImage(image);
152 }
153
154 void
156 {
157 this->m_KdTree = kdtree;
158 }
159
160 void
162 {
164 this->m_NearestNeighborListImage->CopyInformation(featureImage);
165 this->m_NearestNeighborListImage->SetRegions(featureImage->GetLargestPossibleRegion());
166 this->m_NearestNeighborListImage->Allocate();
167 }
168
169 virtual void
171
173
174 unsigned int m_FunctionCount{};
175 unsigned int m_NumberOfNeighbors{ 6 };
178
179protected:
181 : m_KdTree(nullptr)
182 {}
184};
185} // end namespace itk
186
187#endif
Vector< SpacingValueType, VImageDimension > SpacingType
Definition: itkImageBase.h:161
ImageRegion< VImageDimension > RegionType
Definition: itkImageBase.h:154
Index< VImageDimension > IndexType
Definition: itkImageBase.h:141
Size< VImageDimension > SizeType
Definition: itkImageBase.h:150
Point< PointValueType, VImageDimension > PointType
Definition: itkImageBase.h:166
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Templated n-dimensional image class.
Definition: itkImage.h:89
SmartPointer< const Self > ConstPointer
Definition: itkImage.h:97
static Pointer New()
SmartPointer< Self > Pointer
Definition: itkImage.h:96
Light weight base class for most itk classes.
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator
typename FeatureImageType::ConstPointer FeatureImageConstPointer
~RegionBasedLevelSetFunctionSharedData() override=default
void AllocateListImage(const FeatureImageType *featureImage)
void CreateHeavisideFunctionOfLevelSetImage(const unsigned int j, const InputImageType *image)
This class generates a KdTree object without centroid information.
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:52
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
SmartPointer< const Self > ConstPointer
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
long IndexValueType
Definition: itkIntTypes.h:90
unsigned long SizeValueType
Definition: itkIntTypes.h:83