ITK  4.8.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 
76 
77  itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension);
78 
80 
81  typedef TInputImage InputImageType;
82  typedef typename InputImageType::Pointer InputImagePointer;
83  typedef typename InputImageType::ConstPointer InputImageConstPointer;
84  typedef typename InputImageType::PixelType InputPixelType;
85  typedef typename InputImageType::RegionType InputRegionType;
86  typedef typename InputImageType::SizeType InputSizeType;
88  typedef typename InputImageType::SpacingType InputSpacingType;
89  typedef typename InputImageType::IndexType InputIndexType;
91  typedef typename InputImageType::PointType InputPointType;
92 
93  typedef TFeatureImage FeatureImageType;
94  typedef typename FeatureImageType::Pointer FeatureImagePointer;
95  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
96  typedef typename FeatureImageType::PixelType FeaturePixelType;
97  typedef typename FeatureImageType::RegionType FeatureRegionType;
98  typedef typename FeatureImageType::SizeType FeatureSizeType;
100  typedef typename FeatureImageType::SpacingType FeatureSpacingType;
101  typedef typename FeatureImageType::IndexType FeatureIndexType;
102  typedef typename FeatureImageType::PointType FeaturePointType;
103 
104  typedef std::list< unsigned int > ListPixelType;
117 
125 
126  typedef TSingleData LevelSetDataType;
127  typedef typename LevelSetDataType::Pointer LevelSetDataPointer;
128  typedef std::vector< LevelSetDataPointer > LevelSetDataPointerVector;
129  typedef typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator;
130 
131  void SetFunctionCount(const unsigned int & n)
132  {
133  this->m_FunctionCount = n;
134  this->m_LevelSetDataPointerVector.resize(n, ITK_NULLPTR);
135 
138  while ( it != end )
139  {
140  ( *it ) = LevelSetDataType::New();
141  it++;
142  }
143  }
144 
145  void SetNumberOfNeighbors(const unsigned int & n)
146  {
147  this->m_NumberOfNeighbors = n;
148  }
149 
150  void CreateHeavisideFunctionOfLevelSetImage(const unsigned int & j, const InputImageType *image)
151  {
152  m_LevelSetDataPointerVector[j]->CreateHeavisideFunctionOfLevelSetImage(image);
153  }
154 
156  {
157  this->m_KdTree = kdtree;
158  }
159 
160  void AllocateListImage(const FeatureImageType *featureImage)
161  {
163  this->m_NearestNeighborListImage->CopyInformation(featureImage);
164  this->m_NearestNeighborListImage->SetRegions( featureImage->GetLargestPossibleRegion() );
165  this->m_NearestNeighborListImage->Allocate();
166  }
167 
168  virtual void PopulateListImage() = 0;
169 
171 
172  unsigned int m_FunctionCount;
173  unsigned int m_NumberOfNeighbors;
176 
177 protected:
180 
181 private:
182  RegionBasedLevelSetFunctionSharedData(const Self &); //purposely not
183  // implemented
184  void operator=(const Self &); //purposely not
185  // implemented
186 };
187 } //end namespace itk
188 
189 #endif
Superclass::RegionType RegionType
Definition: itkImage.h:140
Light weight base class for most itk classes.
itk::SizeValueType SizeValueType
Definition: itkSize.h:60
void CreateHeavisideFunctionOfLevelSetImage(const unsigned int &j, const InputImageType *image)
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
itk::Statistics::ListSample< CentroidVectorType > SampleType
signed long IndexValueType
Definition: itkIntTypes.h:150
static Pointer New()
itk::Statistics::KdTreeGenerator< SampleType > TreeGeneratorType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Image< ListPixelType, itkGetStaticConstMacro(ImageDimension) > ListImageType
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Superclass::IndexType IndexType
Definition: itkImage.h:122
ImageRegionIteratorWithIndex< ListImageType > ListIteratorType
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:51
Vector< float, itkGetStaticConstMacro(ImageDimension) > CentroidVectorType
void AllocateListImage(const FeatureImageType *featureImage)
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
Definition: itkKdTree.h:483
Templated n-dimensional image class.
Definition: itkImage.h:75