Orfeo Toolbox  3.16
itkConstrainedRegionBasedLevelSetFunctionSharedData.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkConstrainedRegionBasedLevelSetFunctionSharedData.h,v $
5  Language: C++
6  Date: $Date: 2009-05-14 21:46:47 $
7  Version: $Revision: 1.1 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __itkConstrainedRegionBasedLevelSetFunctionSharedData_h
19 #define __itkConstrainedRegionBasedLevelSetFunctionSharedData_h
20 
22 
23 namespace itk
24 {
25 
60 template < class TInputImage, class TFeatureImage, class TSingleData >
62  public RegionBasedLevelSetFunctionSharedData< TInputImage, TFeatureImage, TSingleData >
63 {
64 public:
65 
71 
72  itkStaticConstMacro( ImageDimension, unsigned int, TFeatureImage::ImageDimension );
73 
75  itkNewMacro( Self );
76 
78 
79  typedef TInputImage InputImageType;
90 
91  typedef TFeatureImage FeatureImageType;
101 
114 
119  typedef typename Superclass::TreeType TreeType;
121 
122  typedef TSingleData LevelSetDataType;
126 
128  {
129  ListSpacingType spacing = this->m_NearestNeighborListImage->GetSpacing();
130 
131  ListRegionType region = this->m_NearestNeighborListImage->GetLargestPossibleRegion();
132 
133  ListIteratorType lIt( this->m_NearestNeighborListImage, region );
134 
135  if ( this->m_KdTree.IsNotNull() )
136  {
137  for(lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt )
138  {
139  ListIndexType ind = lIt.GetIndex();
140 
141  float queryPoint[ImageDimension];
142  for( unsigned int i = 0; i < ImageDimension; i++ )
143  {
144  queryPoint[i] = ind[i]*spacing[i];
145  }
146 
147  typename TreeType::InstanceIdentifierVectorType neighbors;
148  this->m_KdTree->Search( queryPoint, this->m_NumberOfNeighbors, neighbors );
149 
150  ListPixelType L;
151  for( unsigned int i = 0; i < this->m_NumberOfNeighbors; i++ )
152  {
153  if( this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion( ind ) )
154  {
155  L.push_back( neighbors[i] );
156  }
157  }
158  lIt.Set( L );
159  }
160  }
161  else
162  {
163  for(lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt )
164  {
165  ListIndexType ind = lIt.GetIndex();
166  ListPixelType L;
167  for( unsigned int i = 0; i < this->m_FunctionCount; i++ )
168  {
169  if( this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion( ind ) )
170  {
171  L.push_back( i );
172  }
173  }
174  lIt.Set( L );
175  }
176  }
177  }
178 
179 protected:
182 
183 private:
184  ConstrainedRegionBasedLevelSetFunctionSharedData(const Self&); //purposely not implemented
185  void operator=(const Self&); //purposely not implemented
186 };
187 
188 } //end namespace itk
189 
190 #endif

Generated at Sat Feb 2 2013 23:33:31 for Orfeo Toolbox with doxygen 1.8.1.1