ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkNarrowBandImageFilterBase.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 itkNarrowBandImageFilterBase_h
19#define itkNarrowBandImageFilterBase_h
20
21#include "itkBooleanStdVector.h"
24#include "itkNarrowBand.h"
25#include "itkObjectStore.h"
27
28
29namespace itk
30{
68template <typename TInputImage, typename TOutputImage>
69class ITK_TEMPLATE_EXPORT NarrowBandImageFilterBase : public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
70{
71public:
72 ITK_DISALLOW_COPY_AND_MOVE(NarrowBandImageFilterBase);
73
79
81 itkOverrideGetNameOfClassMacro(NarrowBandImageFilterBase);
82
84 using typename Superclass::InputImageType;
85 using typename Superclass::OutputImageType;
87
90 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
91
94 using typename Superclass::PixelType;
95
97 using typename Superclass::TimeStepType;
98
100 using IndexType = typename OutputImageType::IndexType;
101
104 using ValueType = typename OutputImageType::ValueType;
105
108
112 using RegionType = typename NarrowBandType::RegionType;
114
116 itkSetMacro(IsoSurfaceValue, ValueType);
117 itkGetConstMacro(IsoSurfaceValue, ValueType);
119
121 // itkGetConstMacro( RMSChange, ValueType);
122
127 void
129 {
130 m_NarrowBand->PushBack(node); // add new node
131 this->Modified();
132 }
133
134
135 void
137 {
138 BandNodeType tmpnode;
139
140 tmpnode.m_Index = index;
141 m_NarrowBand->PushBack(tmpnode);
142 this->Modified();
143 }
144
145 void
146 InsertNarrowBandNode(const IndexType & index, const PixelType & value, const signed char nodestate)
147 {
148 BandNodeType tmpnode;
149
150 tmpnode.m_Data = value;
151 tmpnode.m_Index = index;
152 tmpnode.m_NodeState = nodestate;
153
154 m_NarrowBand->PushBack(tmpnode);
155 this->Modified();
156 }
157
161 void
163 {
164 if (m_NarrowBand->GetTotalRadius() != val)
165 {
166 m_NarrowBand->SetTotalRadius(val);
167 this->Modified();
168 }
169 }
170
171
173 float
175 {
176 return m_NarrowBand->GetTotalRadius();
177 }
178
181 void
183 {
184 if (m_NarrowBand->GetInnerRadius() != val)
185 {
186 m_NarrowBand->SetInnerRadius(val);
187 this->Modified();
188 }
189 }
190
191
193 float
195 {
196 return m_NarrowBand->GetInnerRadius();
197 }
198
204 virtual void
207
208 virtual void
210 {
211 if (m_NarrowBand != ptr)
212 {
213 m_NarrowBand = ptr;
214 this->Modified();
215 }
216 }
217
218 void
220
221protected:
223 {
225 m_NarrowBand->SetTotalRadius(4);
226 m_NarrowBand->SetInnerRadius(2);
228 m_IsoSurfaceValue = 0.0;
229 m_Step = 0;
230 m_Touched = false;
231 }
232
233 ~NarrowBandImageFilterBase() override = default;
234 void
235 PrintSelf(std::ostream & os, Indent indent) const override;
236
238
251
254 std::vector<RegionType> m_RegionList{};
255
258 void
259 GetSplitRegion(const size_t & i, ThreadRegionType & splitRegion);
260
265 void
266 Initialize() override;
267
272 void
274
277 void
279 {}
280
281 /* This function clears all pixels from the narrow band */
282 void
284
292 void
293 GenerateData() override;
294
295 /* Variables to control reinitialization */
298
299 bool m_Touched{};
300
302
304
305private:
306 /* This class does not use AllocateUpdateBuffer to allocate memory for its
307 * narrow band. This is taken care of in SetNarrowBand, and InsertNarrowBandNode
308 * functions. This function is here for compatibility with the
309 * FiniteDifferenceSolver framework.
310 */
311 void
313 {}
314
318 virtual void
319 ThreadedApplyUpdate(const TimeStepType & dt, const ThreadRegionType & regionToProcess, ThreadIdType threadId);
320
321 void
322 ApplyUpdate(const TimeStepType &) override
323 {}
324
328 virtual TimeStepType
330
333 {
334 return 0;
335 }
336};
337} // end namespace itk
338
339#ifndef ITK_MANUAL_INSTANTIATION
340# include "itkNarrowBandImageFilterBase.hxx"
341#endif
342
343#endif
TDataType m_Data
signed char m_NodeState
TIndexType m_Index
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
FiniteDifferenceFunction< TOutputImage > FiniteDifferenceFunctionType
Control indentation during Print() invocation.
Definition itkIndent.h:50
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
typename NarrowBandType::Pointer NarrowBandPointer
void CopyInputToOutput() override
typename NarrowBandType::Iterator NarrowBandIterator
BandNode< IndexType, PixelType > BandNodeType
typename OutputImageType::IndexType IndexType
~NarrowBandImageFilterBase() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
static constexpr unsigned int ImageDimension
void InsertNarrowBandNode(const IndexType &index, const PixelType &value, const signed char nodestate)
typename OutputImageType::ValueType ValueType
virtual void SetNarrowBand(NarrowBandType *ptr)
void InsertNarrowBandNode(const BandNodeType &node)
virtual void ThreadedApplyUpdate(const TimeStepType &dt, const ThreadRegionType &regionToProcess, ThreadIdType threadId)
void ApplyUpdate(const TimeStepType &) override
void InsertNarrowBandNode(const IndexType &index)
FiniteDifferenceImageFilter< TInputImage, TOutputImage > Superclass
typename NarrowBandType::RegionType RegionType
void InitializeIteration() override
void GetSplitRegion(const vcl_size_t &i, ThreadRegionType &splitRegion)
virtual TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess)
Narrow Band class.
SmartPointer< Self > Pointer
typename NodeContainerType::iterator Iterator
virtual void Modified() const
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
SizeValueType IdentifierType
Definition itkIntTypes.h:90
std::vector< Boolean > BooleanStdVectorType