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
117 itkSetMacro(IsoSurfaceValue, ValueType);
118 itkGetConstMacro(IsoSurfaceValue, ValueType);
120
122 // itkGetConstMacro( RMSChange, ValueType);
123
129 void
131 {
132 m_NarrowBand->PushBack(node); // add new node
133 this->Modified();
134 }
135
136 void
138 {
139 BandNodeType tmpnode;
140
141 tmpnode.m_Index = index;
142 m_NarrowBand->PushBack(tmpnode);
143 this->Modified();
144 }
145
146 void
147 InsertNarrowBandNode(const IndexType & index, const PixelType & value, const signed char nodestate)
148 {
149 BandNodeType tmpnode;
150
151 tmpnode.m_Data = value;
152 tmpnode.m_Index = index;
153 tmpnode.m_NodeState = nodestate;
154
155 m_NarrowBand->PushBack(tmpnode);
156 this->Modified();
157 }
158
163 void
165 {
166 if (m_NarrowBand->GetTotalRadius() != val)
167 {
168 m_NarrowBand->SetTotalRadius(val);
169 this->Modified();
170 }
171 }
172
174 [[nodiscard]] float
176 {
177 return m_NarrowBand->GetTotalRadius();
178 }
179
182 void
184 {
185 if (m_NarrowBand->GetInnerRadius() != val)
186 {
187 m_NarrowBand->SetInnerRadius(val);
188 this->Modified();
189 }
190 }
191
193 [[nodiscard]] 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:
225 , m_IsoSurfaceValue(0.0)
226 {
227 m_NarrowBand->SetTotalRadius(4);
228 m_NarrowBand->SetInnerRadius(2);
229 }
230
231 ~NarrowBandImageFilterBase() override = default;
232 void
233 PrintSelf(std::ostream & os, Indent indent) const override;
234
236
249
252 std::vector<RegionType> m_RegionList{};
253
256 void
257 GetSplitRegion(const size_t & i, ThreadRegionType & splitRegion);
258
263 void
264 Initialize() override;
265
270 void
272
275 void
277 {}
278
279 /* This function clears all pixels from the narrow band */
280 void
282
290 void
291 GenerateData() override;
292
293 /* Variables to control reinitialization */
296
297 bool m_Touched{};
298
300
302
303private:
304 /* This class does not use AllocateUpdateBuffer to allocate memory for its
305 * narrow band. This is taken care of in SetNarrowBand, and InsertNarrowBandNode
306 * functions. This function is here for compatibility with the
307 * FiniteDifferenceSolver framework.
308 */
309 void
311 {}
312
316 virtual void
317 ThreadedApplyUpdate(const TimeStepType & dt, const ThreadRegionType & regionToProcess, ThreadIdType threadId);
318
319 void
320 ApplyUpdate(const TimeStepType &) override
321 {}
322
326 virtual TimeStepType
328
331 {
332 return 0;
333 }
334};
335} // end namespace itk
336
337#ifndef ITK_MANUAL_INSTANTIATION
338# include "itkNarrowBandImageFilterBase.hxx"
339#endif
340
341#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
static Pointer New()
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