ITK  5.3.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  * http://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 
27 #include "itkImageRegionIterator.h"
29 
30 namespace itk
31 {
67 template <typename TInputImage, typename TFeatureImage, typename TSingleData>
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_MOVE(RegionBasedLevelSetFunctionSharedData);
72 
77 
78  static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
79 
81 
82  using InputImageType = TInputImage;
83  using InputImagePointer = typename InputImageType::Pointer;
84  using InputImageConstPointer = typename InputImageType::ConstPointer;
85  using InputPixelType = typename InputImageType::PixelType;
89  using InputSpacingType = typename InputImageType::SpacingType;
93 
94  using FeatureImageType = TFeatureImage;
95  using FeatureImagePointer = typename FeatureImageType::Pointer;
96  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
97  using FeaturePixelType = typename FeatureImageType::PixelType;
101  using FeatureSpacingType = typename FeatureImageType::SpacingType;
104 
105  using ListPixelType = std::list<unsigned int>;
117 
123  using KdTreePointer = typename TreeType::Pointer;
124 
125  using LevelSetDataType = TSingleData;
126  using LevelSetDataPointer = typename LevelSetDataType::Pointer;
127  using LevelSetDataPointerVector = std::vector<LevelSetDataPointer>;
128  using LevelSetDataPointerVectorIterator = typename LevelSetDataPointerVector::iterator;
129 
130  void
131  SetFunctionCount(const unsigned int & n)
132  {
133  this->m_FunctionCount = n;
134  this->m_LevelSetDataPointerVector.resize(n, nullptr);
135 
136  auto it = m_LevelSetDataPointerVector.begin();
137  auto end = m_LevelSetDataPointerVector.end();
138  while (it != end)
139  {
140  (*it) = LevelSetDataType::New();
141  it++;
142  }
143  }
144 
145  void
146  SetNumberOfNeighbors(const unsigned int & n)
147  {
148  this->m_NumberOfNeighbors = n;
149  }
150 
151  void
152  CreateHeavisideFunctionOfLevelSetImage(const unsigned int & j, const InputImageType * image)
153  {
154  m_LevelSetDataPointerVector[j]->CreateHeavisideFunctionOfLevelSetImage(image);
155  }
156 
157  void
159  {
160  this->m_KdTree = kdtree;
161  }
162 
163  void
164  AllocateListImage(const FeatureImageType * featureImage)
165  {
167  this->m_NearestNeighborListImage->CopyInformation(featureImage);
168  this->m_NearestNeighborListImage->SetRegions(featureImage->GetLargestPossibleRegion());
169  this->m_NearestNeighborListImage->Allocate();
170  }
171 
172  virtual void
173  PopulateListImage() = 0;
174 
176 
177  unsigned int m_FunctionCount;
178  unsigned int m_NumberOfNeighbors{ 6 };
181 
182 protected:
184  : m_KdTree(nullptr)
185  {}
186  ~RegionBasedLevelSetFunctionSharedData() override = default;
187 };
188 } // end namespace itk
189 
190 #endif
itk::RegionBasedLevelSetFunctionSharedData::m_NumberOfNeighbors
unsigned int m_NumberOfNeighbors
Definition: itkRegionBasedLevelSetFunctionSharedData.h:178
itk::RegionBasedLevelSetFunctionSharedData::m_KdTree
KdTreePointer m_KdTree
Definition: itkRegionBasedLevelSetFunctionSharedData.h:180
itk::RegionBasedLevelSetFunctionSharedData::FeatureIndexType
typename FeatureImageType::IndexType FeatureIndexType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:102
itk::RegionBasedLevelSetFunctionSharedData::SetKdTree
void SetKdTree(KdTreePointer kdtree)
Definition: itkRegionBasedLevelSetFunctionSharedData.h:158
itk::RegionBasedLevelSetFunctionSharedData::ListPixelType
std::list< unsigned int > ListPixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:105
itk::RegionBasedLevelSetFunctionSharedData::m_NearestNeighborListImage
ListImagePointer m_NearestNeighborListImage
Definition: itkRegionBasedLevelSetFunctionSharedData.h:179
itk::ImageBase::SpacingType
Vector< SpacingValueType, VImageDimension > SpacingType
Definition: itkImageBase.h:152
itk::RegionBasedLevelSetFunctionSharedData::CreateHeavisideFunctionOfLevelSetImage
void CreateHeavisideFunctionOfLevelSetImage(const unsigned int &j, const InputImageType *image)
Definition: itkRegionBasedLevelSetFunctionSharedData.h:152
itk::RegionBasedLevelSetFunctionSharedData::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:84
itk::RegionBasedLevelSetFunctionSharedData::m_FunctionCount
unsigned int m_FunctionCount
Definition: itkRegionBasedLevelSetFunctionSharedData.h:177
itk::Statistics::KdTreeGenerator::Pointer
SmartPointer< Self > Pointer
Definition: itkKdTreeGenerator.h:79
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::RegionBasedLevelSetFunctionSharedData::ListSizeType
typename ListImageType::SizeType ListSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:110
itk::RegionBasedLevelSetFunctionSharedData::InputImageType
TInputImage InputImageType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:82
itk::RegionBasedLevelSetFunctionSharedData::ListSizeValueType
typename ListSizeType::SizeValueType ListSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:111
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::Statistics::ListSample
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:51
itk::RegionBasedLevelSetFunctionSharedData::FeatureSizeValueType
typename FeatureSizeType::SizeValueType FeatureSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:100
itk::RegionBasedLevelSetFunctionSharedData::InputSizeValueType
typename InputSizeType::SizeValueType InputSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:88
itk::LightObject::LightObject
LightObject()
itk::RegionBasedLevelSetFunctionSharedData::TreePointer
typename TreeGeneratorType::Pointer TreePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:121
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::RegionBasedLevelSetFunctionSharedData::PopulateListImage
virtual void PopulateListImage()=0
itk::Image::Pointer
SmartPointer< Self > Pointer
Definition: itkImage.h:96
itk::RegionBasedLevelSetFunctionSharedData::KdTreePointer
typename TreeType::Pointer KdTreePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:123
itk::RegionBasedLevelSetFunctionSharedData::TreeType
typename TreeGeneratorType::KdTreeType TreeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:122
itkImageRegionIteratorWithIndex.h
itk::RegionBasedLevelSetFunctionSharedData::InputIndexValueType
typename InputIndexType::IndexValueType InputIndexValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:91
itk::RegionBasedLevelSetFunctionSharedData::SetFunctionCount
void SetFunctionCount(const unsigned int &n)
Definition: itkRegionBasedLevelSetFunctionSharedData.h:131
itk::RegionBasedLevelSetFunctionSharedData::FeaturePixelType
typename FeatureImageType::PixelType FeaturePixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:97
itk::ImageBase::PointType
Point< PointValueType, VImageDimension > PointType
Definition: itkImageBase.h:157
itk::RegionBasedLevelSetFunctionSharedData::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:83
itk::RegionBasedLevelSetFunctionSharedData::FeatureSizeType
typename FeatureImageType::SizeType FeatureSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:99
itk::ImageBase::IndexType
Index< VImageDimension > IndexType
Definition: itkImageBase.h:132
itk::RegionBasedLevelSetFunctionSharedData::~RegionBasedLevelSetFunctionSharedData
~RegionBasedLevelSetFunctionSharedData() override=default
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::RegionBasedLevelSetFunctionSharedData::RegionBasedLevelSetFunctionSharedData
RegionBasedLevelSetFunctionSharedData()
Definition: itkRegionBasedLevelSetFunctionSharedData.h:183
itk::RegionBasedLevelSetFunctionSharedData::ListImageConstPointer
typename ListImageType::ConstPointer ListImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:108
itk::RegionBasedLevelSetFunctionSharedData::ListSpacingType
typename ListImageType::SpacingType ListSpacingType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:112
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::RegionBasedLevelSetFunctionSharedData::InputSpacingType
typename InputImageType::SpacingType InputSpacingType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:89
itk::RegionBasedLevelSetFunctionSharedData::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:95
itk::RegionBasedLevelSetFunctionSharedData::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:90
itk::RegionBasedLevelSetFunctionSharedData::AllocateListImage
void AllocateListImage(const FeatureImageType *featureImage)
Definition: itkRegionBasedLevelSetFunctionSharedData.h:164
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::RegionBasedLevelSetFunctionSharedData::SetNumberOfNeighbors
void SetNumberOfNeighbors(const unsigned int &n)
Definition: itkRegionBasedLevelSetFunctionSharedData.h:146
itk::RegionBasedLevelSetFunctionSharedData::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:85
itk::Statistics::KdTreeGenerator::KdTreeType
KdTree< TSample > KdTreeType
Definition: itkKdTreeGenerator.h:96
itk::RegionBasedLevelSetFunctionSharedData::InputPointType
typename InputImageType::PointType InputPointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:92
itk::ImageBase::RegionType
ImageRegion< VImageDimension > RegionType
Definition: itkImageBase.h:145
itk::RegionBasedLevelSetFunctionSharedData::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:87
itk::RegionBasedLevelSetFunctionSharedData::ListIndexType
typename ListImageType::IndexType ListIndexType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:113
itk::RegionBasedLevelSetFunctionSharedData::FeaturePointType
typename FeatureImageType::PointType FeaturePointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:103
itk::RegionBasedLevelSetFunctionSharedData::ListPointType
typename ListImageType::PointType ListPointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:115
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataType
TSingleData LevelSetDataType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:125
itk::RegionBasedLevelSetFunctionSharedData::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:96
itkListSample.h
itk::ImageRegionIteratorWithIndex
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Definition: itkImageRegionIteratorWithIndex.h:73
itk::RegionBasedLevelSetFunctionSharedData::ListRegionType
typename ListImageType::RegionType ListRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:109
itk::RegionBasedLevelSetFunctionSharedData::InputRegionType
typename InputImageType::RegionType InputRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:86
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVectorIterator
typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator
Definition: itkRegionBasedLevelSetFunctionSharedData.h:128
itk::RegionBasedLevelSetFunctionSharedData::FeatureRegionType
typename FeatureImageType::RegionType FeatureRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:98
itk::RegionBasedLevelSetFunctionSharedData
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
Definition: itkRegionBasedLevelSetFunctionSharedData.h:68
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Image::New
static Pointer New()
itk::RegionBasedLevelSetFunctionSharedData::ImageDimension
static constexpr unsigned int ImageDimension
Definition: itkRegionBasedLevelSetFunctionSharedData.h:78
itkVector.h
itkKdTreeGenerator.h
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itk::RegionBasedLevelSetFunctionSharedData::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:94
itk::RegionBasedLevelSetFunctionSharedData::ListImagePointer
typename ListImageType::Pointer ListImagePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:107
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::RegionBasedLevelSetFunctionSharedData::m_LevelSetDataPointerVector
LevelSetDataPointerVector m_LevelSetDataPointerVector
Definition: itkRegionBasedLevelSetFunctionSharedData.h:175
itk::Image::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkImage.h:97
itk::ImageBase::SizeType
Size< VImageDimension > SizeType
Definition: itkImageBase.h:141
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointer
typename LevelSetDataType::Pointer LevelSetDataPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:126
itk::Statistics::KdTreeGenerator
This class generates a KdTree object without centroid information.
Definition: itkKdTreeGenerator.h:71
itk::RegionBasedLevelSetFunctionSharedData::ListIndexValueType
typename ListIndexType::IndexValueType ListIndexValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:114
itk::RegionBasedLevelSetFunctionSharedData::FeatureSpacingType
typename FeatureImageType::SpacingType FeatureSpacingType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:101
itkLightObject.h
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVector
std::vector< LevelSetDataPointer > LevelSetDataPointerVector
Definition: itkRegionBasedLevelSetFunctionSharedData.h:127
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83