ITK  4.4.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< class TInputImage, class TFeatureImage, class 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, 0);
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
190