ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkNarrowBandLevelSetImageFilter.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 itkNarrowBandLevelSetImageFilter_h
19#define itkNarrowBandLevelSetImageFilter_h
20
25#include "itkMath.h"
26
27namespace itk
28{
143template <typename TInputImage,
144 typename TFeatureImage,
145 typename TOutputPixelType = float,
147class ITK_TEMPLATE_EXPORT NarrowBandLevelSetImageFilter : public NarrowBandImageFilterBase<TInputImage, TOutputImage>
148{
149public:
150 ITK_DISALLOW_COPY_AND_MOVE(NarrowBandLevelSetImageFilter);
151
157
159 using typename Superclass::ValueType;
160 using typename Superclass::IndexType;
161 using typename Superclass::TimeStepType;
162 using typename Superclass::InputImageType;
163
165 using OutputImageType = TOutputImage;
166 using FeatureImageType = TFeatureImage;
167
170
173
175 itkOverrideGetNameOfClassMacro(NarrowBandLevelSetImageFilter);
176
179 virtual void
181 {
182 this->ProcessObject::SetNthInput(1, const_cast<FeatureImageType *>(f));
183 m_SegmentationFunction->SetFeatureImage(f);
184 }
185
186
187 virtual FeatureImageType *
189 {
190 return (static_cast<FeatureImageType *>(this->ProcessObject::GetInput(1)));
191 }
192
195 virtual void
197 {
198 this->SetInput(f);
199 }
200
201 virtual const typename SegmentationFunctionType::ImageType *
203 {
204 return m_SegmentationFunction->GetSpeedImage();
205 }
206
207 virtual const typename SegmentationFunctionType::VectorImageType *
209 {
210 return m_SegmentationFunction->GetAdvectionImage();
211 }
212
216 void
218 {
219 itkWarningMacro(
220 << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
222 }
223
224
225 void
227 {
228 itkWarningMacro(
229 << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
231 }
232
235 void
237 {
238 itkWarningMacro("SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
239 if (u)
240 {
241 this->SetReverseExpansionDirection(false);
242 }
243 else
244 {
246 }
247 }
248
249
250 bool
252 {
253 itkWarningMacro(
254 << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
255 if (this->GetReverseExpansionDirection() == false)
256 {
257 return true;
258 }
259
260 return false;
261 }
262
271 itkSetMacro(ReverseExpansionDirection, bool);
272 itkGetConstMacro(ReverseExpansionDirection, bool);
273 itkBooleanMacro(ReverseExpansionDirection);
275
280 void
282 {
283 if (v != m_SegmentationFunction->GetPropagationWeight())
284 {
285 this->SetPropagationScaling(v);
286 }
287 if (v != m_SegmentationFunction->GetAdvectionWeight())
288 {
289 this->SetAdvectionScaling(v);
290 }
291 }
292
293
296 void
298 {
299 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
300 {
301 m_SegmentationFunction->SetPropagationWeight(v);
302 }
303 }
304
305
306 ValueType
308 {
309 return m_SegmentationFunction->GetPropagationWeight();
310 }
311
314 void
316 {
317 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
318 {
319 m_SegmentationFunction->SetAdvectionWeight(v);
320 }
321 }
322
323
324 ValueType
326 {
327 return m_SegmentationFunction->GetAdvectionWeight();
328 }
329
334 void
336 {
337 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetCurvatureWeight()))
338 {
339 m_SegmentationFunction->SetCurvatureWeight(v);
340 }
341 }
342
343
344 ValueType
346 {
347 return m_SegmentationFunction->GetCurvatureWeight();
348 }
349
352 virtual void
354
360
363 void
364 SetMaximumIterations(unsigned int i)
365 {
366 itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
367 this->SetNumberOfIterations(i);
368 }
369
370
371 unsigned int
373 {
374 itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
375 return this->GetNumberOfIterations();
376 }
377
378 void
379 SetMaximumRMSError(const double) override
380 {
381 itkWarningMacro("The current implementation of this solver does not compute maximum RMS change. The maximum RMS "
382 "error value will not be set or used.");
383 }
384
386
387protected:
388 ~NarrowBandLevelSetImageFilter() override = default;
390
391 void
392 PrintSelf(std::ostream & os, Indent indent) const override;
393
394
396 void
398 {
400 // Estimate the progress of the filter
401 this->UpdateProgress(static_cast<float>(this->GetElapsedIterations()) /
402 static_cast<float>(this->GetNumberOfIterations()));
403 }
404
405
408
409 void
411
414 void
415 GenerateData() override;
416
420
422
426
428
430
431private:
433};
434} // end namespace itk
435
436#ifndef ITK_MANUAL_INSTANTIATION
437# include "itkNarrowBandLevelSetImageFilter.hxx"
438#endif
439
440#endif
This class compute the signed (positive and negative) chamfer distance in a narrow band.
virtual const IdentifierType & GetNumberOfIterations() const
virtual const IdentifierType & GetElapsedIterations() const
virtual void SetNumberOfIterations(IdentifierType _arg)
virtual void SetInput(const InputImageType *input)
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:50
Compute an approximate distance from an interpolated isocontour to the close grid points.
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
typename OutputImageType::IndexType IndexType
typename OutputImageType::ValueType ValueType
void InitializeIteration() override
virtual void SetFeatureImage(const FeatureImageType *f)
virtual const SegmentationFunctionType::ImageType * GetSpeedImage() const
virtual void SetSegmentationFunction(SegmentationFunctionType *s)
void PrintSelf(std::ostream &os, Indent indent) const override
virtual const SegmentationFunctionType::VectorImageType * GetAdvectionImage() const
virtual SegmentationFunctionType * GetSegmentationFunction()
~NarrowBandLevelSetImageFilter() override=default
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
void UpdateProgress(float progress)
Update the progress of the process object.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition itkMath.h:731
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....