ITK  5.2.0
Insight Toolkit
itkConstrainedRegionBasedLevelSetFunctionSharedData.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 itkConstrainedRegionBasedLevelSetFunctionSharedData_h
19 #define itkConstrainedRegionBasedLevelSetFunctionSharedData_h
20 
22 
23 namespace itk
24 {
60 template <typename TInputImage, typename TFeatureImage, typename TSingleData>
62  : public RegionBasedLevelSetFunctionSharedData<TInputImage, TFeatureImage, TSingleData>
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_MOVE(ConstrainedRegionBasedLevelSetFunctionSharedData);
66 
71 
72  static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
73 
75  itkNewMacro(Self);
76 
78 
79  using InputImageType = TInputImage;
90 
91  using FeatureImageType = TFeatureImage;
101 
114 
119  using TreeType = typename Superclass::TreeType;
121 
122  using LevelSetDataType = TSingleData;
126 
127  void
128  PopulateListImage() override
129  {
130  ListSpacingType spacing = this->m_NearestNeighborListImage->GetSpacing();
131 
132  ListRegionType region = this->m_NearestNeighborListImage->GetLargestPossibleRegion();
133 
134  ListIteratorType lIt(this->m_NearestNeighborListImage, region);
135 
136  if (this->m_KdTree.IsNotNull())
137  {
138  for (lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt)
139  {
140  ListIndexType ind = lIt.GetIndex();
141 
142  float queryPoint[ImageDimension];
143  for (unsigned int i = 0; i < ImageDimension; i++)
144  {
145  queryPoint[i] = ind[i] * spacing[i];
146  }
147 
148  typename TreeType::InstanceIdentifierVectorType neighbors;
149  this->m_KdTree->Search(queryPoint, this->m_NumberOfNeighbors, neighbors);
150 
151  ListPixelType L;
152  for (unsigned int i = 0; i < this->m_NumberOfNeighbors; i++)
153  {
154  if (this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion(ind))
155  {
156  L.push_back(neighbors[i]);
157  }
158  }
159  lIt.Set(L);
160  }
161  }
162  else
163  {
164  for (lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt)
165  {
166  ListIndexType ind = lIt.GetIndex();
167  ListPixelType L;
168  for (unsigned int i = 0; i < this->m_FunctionCount; i++)
169  {
170  if (this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion(ind))
171  {
172  L.push_back(i);
173  }
174  }
175  lIt.Set(L);
176  }
177  }
178  }
179 
180 protected:
182  : Superclass()
183  {}
185 };
186 } // end namespace itk
187 
188 #endif
itk::RegionBasedLevelSetFunctionSharedData::m_NumberOfNeighbors
unsigned int m_NumberOfNeighbors
Definition: itkRegionBasedLevelSetFunctionSharedData.h:178
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureSizeType
typename Superclass::FeatureSizeType FeatureSizeType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:96
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListIteratorType
typename Superclass::ListIteratorType ListIteratorType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:113
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListIndexType
typename Superclass::ListIndexType ListIndexType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:110
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::TreePointer
typename Superclass::TreePointer TreePointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:118
itk::RegionBasedLevelSetFunctionSharedData::m_KdTree
KdTreePointer m_KdTree
Definition: itkRegionBasedLevelSetFunctionSharedData.h:180
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListImageType
typename Superclass::ListImageType ListImageType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:103
itk::RegionBasedLevelSetFunctionSharedData::FeatureIndexType
typename FeatureImageType::IndexType FeatureIndexType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:102
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::LevelSetDataType
TSingleData LevelSetDataType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:122
itk::RegionBasedLevelSetFunctionSharedData::ListPixelType
std::list< unsigned int > ListPixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:105
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ImageDimension
static constexpr unsigned int ImageDimension
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:72
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputSizeType
typename Superclass::InputSizeType InputSizeType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:84
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListRegionType
typename Superclass::ListRegionType ListRegionType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:106
itk::RegionBasedLevelSetFunctionSharedData::m_NearestNeighborListImage
ListImagePointer m_NearestNeighborListImage
Definition: itkRegionBasedLevelSetFunctionSharedData.h:179
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::CentroidVectorType
typename Superclass::CentroidVectorType CentroidVectorType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:115
itk::RegionBasedLevelSetFunctionSharedData::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:84
itk::RegionBasedLevelSetFunctionSharedData::m_FunctionCount
unsigned int m_FunctionCount
Definition: itkRegionBasedLevelSetFunctionSharedData.h:177
itk::RegionBasedLevelSetFunctionSharedData::ListSizeType
typename ListImageType::SizeType ListSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:110
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::LevelSetDataPointer
typename Superclass::LevelSetDataPointer LevelSetDataPointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:123
itk::RegionBasedLevelSetFunctionSharedData::ListSizeValueType
typename ListSizeType::SizeValueType ListSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:111
itk::RegionBasedLevelSetFunctionSharedData::FeatureSizeValueType
typename FeatureSizeType::SizeValueType FeatureSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:100
itk::RegionBasedLevelSetFunctionSharedData::InputSizeValueType
typename InputSizeType::SizeValueType InputSizeValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:88
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListSpacingType
typename Superclass::ListSpacingType ListSpacingType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:109
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureSizeValueType
typename Superclass::FeatureSizeValueType FeatureSizeValueType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:97
itk::RegionBasedLevelSetFunctionSharedData::TreePointer
typename TreeGeneratorType::Pointer TreePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:121
itk::SmartPointer< Self >
itk::RegionBasedLevelSetFunctionSharedData::KdTreePointer
typename TreeType::Pointer KdTreePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:123
itk::RegionBasedLevelSetFunctionSharedData::TreeType
typename TreeGeneratorType::KdTreeType TreeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:122
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListSizeType
typename Superclass::ListSizeType ListSizeType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:107
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeaturePointType
typename Superclass::FeaturePointType FeaturePointType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:100
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputPointType
typename Superclass::InputPointType InputPointType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:89
itk::RegionBasedLevelSetFunctionSharedData::InputIndexValueType
typename InputIndexType::IndexValueType InputIndexValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:91
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputImagePointer
typename Superclass::InputImagePointer InputImagePointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:80
itk::ConstrainedRegionBasedLevelSetFunctionSharedData
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:61
itk::RegionBasedLevelSetFunctionSharedData::TreeGeneratorType
itk::Statistics::KdTreeGenerator< SampleType > TreeGeneratorType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:120
itk::RegionBasedLevelSetFunctionSharedData::FeaturePixelType
typename FeatureImageType::PixelType FeaturePixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:97
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureIndexType
typename Superclass::FeatureIndexType FeatureIndexType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:99
itk::RegionBasedLevelSetFunctionSharedData::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:83
itk::RegionBasedLevelSetFunctionSharedData::FeatureSizeType
typename FeatureImageType::SizeType FeatureSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:99
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListImageConstPointer
typename Superclass::ListImageConstPointer ListImageConstPointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:105
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputPixelType
typename Superclass::InputPixelType InputPixelType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:82
itkRegionBasedLevelSetFunctionSharedData.h
itk::RegionBasedLevelSetFunctionSharedData::ListImageConstPointer
typename ListImageType::ConstPointer ListImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:108
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::PopulateListImage
void PopulateListImage() override
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:128
itk::RegionBasedLevelSetFunctionSharedData::ListSpacingType
typename ListImageType::SpacingType ListSpacingType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:112
itk::RegionBasedLevelSetFunctionSharedData::ListIteratorType
ImageRegionIteratorWithIndex< ListImageType > ListIteratorType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:116
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::KdTreePointer
typename Superclass::KdTreePointer KdTreePointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:120
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureSpacingType
typename Superclass::FeatureSpacingType FeatureSpacingType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:98
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::ConstrainedRegionBasedLevelSetFunctionSharedData::TreeGeneratorType
typename Superclass::TreeGeneratorType TreeGeneratorType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:117
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputIndexType
typename Superclass::InputIndexType InputIndexType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:87
itk::RegionBasedLevelSetFunctionSharedData::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:85
itk::RegionBasedLevelSetFunctionSharedData::ListImageType
Image< ListPixelType, Self::ImageDimension > ListImageType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:106
itk::RegionBasedLevelSetFunctionSharedData::InputPointType
typename InputImageType::PointType InputPointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:92
itk::RegionBasedLevelSetFunctionSharedData::CentroidVectorType
Vector< float, Self::ImageDimension > CentroidVectorType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:118
itk::RegionBasedLevelSetFunctionSharedData::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:87
itk::RegionBasedLevelSetFunctionSharedData::ListIndexType
typename ListImageType::IndexType ListIndexType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:113
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListIndexValueType
typename Superclass::ListIndexValueType ListIndexValueType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:111
itk::RegionBasedLevelSetFunctionSharedData::FeaturePointType
typename FeatureImageType::PointType FeaturePointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:103
itk::RegionBasedLevelSetFunctionSharedData::ListPointType
typename ListImageType::PointType ListPointType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:115
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListImagePointer
typename Superclass::ListImagePointer ListImagePointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:104
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureImageConstPointer
typename Superclass::FeatureImageConstPointer FeatureImageConstPointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:93
itk::RegionBasedLevelSetFunctionSharedData::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:96
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::~ConstrainedRegionBasedLevelSetFunctionSharedData
~ConstrainedRegionBasedLevelSetFunctionSharedData() override=default
itk::RegionBasedLevelSetFunctionSharedData::ListRegionType
typename ListImageType::RegionType ListRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:109
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputSpacingType
typename Superclass::InputSpacingType InputSpacingType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:86
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureImagePointer
typename Superclass::FeatureImagePointer FeatureImagePointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:92
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListPointType
typename Superclass::ListPointType ListPointType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:112
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeaturePixelType
typename Superclass::FeaturePixelType FeaturePixelType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:94
itk::RegionBasedLevelSetFunctionSharedData::InputRegionType
typename InputImageType::RegionType InputRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:86
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVector
typename Superclass::LevelSetDataPointerVector LevelSetDataPointerVector
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:124
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:91
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVectorIterator
typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator
Definition: itkRegionBasedLevelSetFunctionSharedData.h:128
itk::RegionBasedLevelSetFunctionSharedData::FeatureRegionType
typename FeatureImageType::RegionType FeatureRegionType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:98
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::FeatureRegionType
typename Superclass::FeatureRegionType FeatureRegionType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:95
itk::RegionBasedLevelSetFunctionSharedData
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
Definition: itkRegionBasedLevelSetFunctionSharedData.h:68
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputIndexValueType
typename Superclass::InputIndexValueType InputIndexValueType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:88
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListSizeValueType
typename Superclass::ListSizeValueType ListSizeValueType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:108
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVectorIterator
typename Superclass::LevelSetDataPointerVectorIterator LevelSetDataPointerVectorIterator
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:125
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::TreeType
typename Superclass::TreeType TreeType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:119
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::SampleType
typename Superclass::SampleType SampleType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:116
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputRegionType
typename Superclass::InputRegionType InputRegionType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:83
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputImageType
TInputImage InputImageType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:79
itk::RegionBasedLevelSetFunctionSharedData::ListImagePointer
typename ListImageType::Pointer ListImagePointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:107
itk::RegionBasedLevelSetFunctionSharedData::m_LevelSetDataPointerVector
LevelSetDataPointerVector m_LevelSetDataPointerVector
Definition: itkRegionBasedLevelSetFunctionSharedData.h:175
itk::RegionBasedLevelSetFunctionSharedData::SampleType
itk::Statistics::ListSample< CentroidVectorType > SampleType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:119
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointer
typename LevelSetDataType::Pointer LevelSetDataPointer
Definition: itkRegionBasedLevelSetFunctionSharedData.h:126
itk::RegionBasedLevelSetFunctionSharedData::ListIndexValueType
typename ListIndexType::IndexValueType ListIndexValueType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:114
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputImageConstPointer
typename Superclass::InputImageConstPointer InputImageConstPointer
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:81
itk::RegionBasedLevelSetFunctionSharedData::FeatureSpacingType
typename FeatureImageType::SpacingType FeatureSpacingType
Definition: itkRegionBasedLevelSetFunctionSharedData.h:101
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ListPixelType
typename Superclass::ListPixelType ListPixelType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:102
itk::RegionBasedLevelSetFunctionSharedData::LevelSetDataPointerVector
std::vector< LevelSetDataPointer > LevelSetDataPointerVector
Definition: itkRegionBasedLevelSetFunctionSharedData.h:127
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::InputSizeValueType
typename Superclass::InputSizeValueType InputSizeValueType
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:85
itk::ConstrainedRegionBasedLevelSetFunctionSharedData::ConstrainedRegionBasedLevelSetFunctionSharedData
ConstrainedRegionBasedLevelSetFunctionSharedData()
Definition: itkConstrainedRegionBasedLevelSetFunctionSharedData.h:181