ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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 * https://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
23namespace itk
24{
53template <typename TInputImage, typename TFeatureImage, typename TSingleData>
55 : public RegionBasedLevelSetFunctionSharedData<TInputImage, TFeatureImage, TSingleData>
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(ConstrainedRegionBasedLevelSetFunctionSharedData);
59
64
65 static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
66
68 itkNewMacro(Self);
69
70 itkOverrideGetNameOfClassMacro(ConstrainedRegionBasedLevelSetFunctionSharedData);
71
72 using InputImageType = TInputImage;
73 using typename Superclass::InputImagePointer;
75 using typename Superclass::InputPixelType;
76 using typename Superclass::InputRegionType;
77 using typename Superclass::InputSizeType;
78 using typename Superclass::InputSizeValueType;
79 using typename Superclass::InputSpacingType;
80 using typename Superclass::InputIndexType;
82 using typename Superclass::InputPointType;
83
84 using FeatureImageType = TFeatureImage;
87 using typename Superclass::FeaturePixelType;
88 using typename Superclass::FeatureRegionType;
89 using typename Superclass::FeatureSizeType;
91 using typename Superclass::FeatureSpacingType;
92 using typename Superclass::FeatureIndexType;
93 using typename Superclass::FeaturePointType;
94
95 using typename Superclass::ListPixelType;
96 using typename Superclass::ListImageType;
97 using typename Superclass::ListImagePointer;
99 using typename Superclass::ListRegionType;
100 using typename Superclass::ListSizeType;
101 using typename Superclass::ListSizeValueType;
102 using typename Superclass::ListSpacingType;
103 using typename Superclass::ListIndexType;
104 using typename Superclass::ListIndexValueType;
105 using typename Superclass::ListPointType;
106 using typename Superclass::ListIteratorType;
107
108 using typename Superclass::CentroidVectorType;
109 using typename Superclass::SampleType;
110 using typename Superclass::TreeGeneratorType;
111 using typename Superclass::TreePointer;
112 using typename Superclass::TreeType;
113 using typename Superclass::KdTreePointer;
114
115 using LevelSetDataType = TSingleData;
116 using typename Superclass::LevelSetDataPointer;
119
120 void
122 {
123 ListSpacingType spacing = this->m_NearestNeighborListImage->GetSpacing();
124
125 ListRegionType region = this->m_NearestNeighborListImage->GetLargestPossibleRegion();
126
128
129 if (this->m_KdTree.IsNotNull())
130 {
131 for (lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt)
132 {
133 ListIndexType ind = lIt.GetIndex();
134
135 float queryPoint[ImageDimension];
136 for (unsigned int i = 0; i < ImageDimension; ++i)
137 {
138 queryPoint[i] = ind[i] * spacing[i];
139 }
140
141 typename TreeType::InstanceIdentifierVectorType neighbors;
142 this->m_KdTree->Search(queryPoint, this->m_NumberOfNeighbors, neighbors);
143
145 for (unsigned int i = 0; i < this->m_NumberOfNeighbors; ++i)
146 {
147 if (this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion(ind))
148 {
149 L.push_back(neighbors[i]);
150 }
151 }
152 lIt.Set(L);
153 }
154 }
155 else
156 {
157 for (lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt)
158 {
159 ListIndexType ind = lIt.GetIndex();
161 for (unsigned int i = 0; i < this->m_FunctionCount; ++i)
162 {
163 if (this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion(ind))
164 {
165 L.push_back(i);
166 }
167 }
168 lIt.Set(L);
169 }
170 }
171 }
172
173protected:
178};
179} // end namespace itk
180
181#endif
RegionBasedLevelSetFunctionSharedData< TInputImage, TFeatureImage, TSingleData > Superclass
itk::Statistics::ListSample< CentroidVectorType > SampleType
typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator
ImageRegionIteratorWithIndex< ListImageType > ListIteratorType
Image< ListPixelType, Self::ImageDimension > ListImageType
itk::Statistics::KdTreeGenerator< SampleType > TreeGeneratorType
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....