ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRegionBasedLevelSetFunctionSharedData.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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_ASSIGN(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 >;
106  using ListImageType =
118 
119  using CentroidVectorType =
125  using KdTreePointer = typename TreeType::Pointer;
126 
127  using LevelSetDataType = TSingleData;
128  using LevelSetDataPointer = typename LevelSetDataType::Pointer;
129  using LevelSetDataPointerVector = std::vector< LevelSetDataPointer >;
130  using LevelSetDataPointerVectorIterator = typename LevelSetDataPointerVector::iterator;
131 
132  void SetFunctionCount(const unsigned int & n)
133  {
134  this->m_FunctionCount = n;
135  this->m_LevelSetDataPointerVector.resize(n, nullptr);
136 
137  auto it = m_LevelSetDataPointerVector.begin();
138  auto end = m_LevelSetDataPointerVector.end();
139  while ( it != end )
140  {
141  ( *it ) = LevelSetDataType::New();
142  it++;
143  }
144  }
145 
146  void SetNumberOfNeighbors(const unsigned int & n)
147  {
148  this->m_NumberOfNeighbors = n;
149  }
150 
151  void CreateHeavisideFunctionOfLevelSetImage(const unsigned int & j, const InputImageType *image)
152  {
153  m_LevelSetDataPointerVector[j]->CreateHeavisideFunctionOfLevelSetImage(image);
154  }
155 
157  {
158  this->m_KdTree = kdtree;
159  }
160 
161  void AllocateListImage(const FeatureImageType *featureImage)
162  {
164  this->m_NearestNeighborListImage->CopyInformation(featureImage);
165  this->m_NearestNeighborListImage->SetRegions( featureImage->GetLargestPossibleRegion() );
166  this->m_NearestNeighborListImage->Allocate();
167  }
168 
169  virtual void PopulateListImage() = 0;
170 
172 
173  unsigned int m_FunctionCount;
174  unsigned int m_NumberOfNeighbors;
177 
178 protected:
181 };
182 } //end namespace itk
183 
184 #endif
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Light weight base class for most itk classes.
void CreateHeavisideFunctionOfLevelSetImage(const unsigned int &j, const InputImageType *image)
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
static Pointer New()
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
signed long IndexValueType
Definition: itkIntTypes.h:90
typename Superclass::RegionType RegionType
Definition: itkImage.h:139
This class generates a KdTree object without centroid information.
typename Superclass::SizeType SizeType
Definition: itkImage.h:128
typename Superclass::SpacingType SpacingType
Definition: itkImage.h:143
typename Superclass::IndexType IndexType
Definition: itkImage.h:121
SmartPointer< const Self > ConstPointer
Definition: itkImage.h:84
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:51
void AllocateListImage(const FeatureImageType *featureImage)
SmartPointer< Self > Pointer
Definition: itkImage.h:83
typename Superclass::PointType PointType
Definition: itkImage.h:148
typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator
Templated n-dimensional image class.
Definition: itkImage.h:75