ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkSegmentationLevelSetImageFilter.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 itkSegmentationLevelSetImageFilter_h
19#define itkSegmentationLevelSetImageFilter_h
20
23#include "itkMath.h"
24
25namespace itk
26{
143template <typename TInputImage, typename TFeatureImage, typename TOutputPixelType = float>
144class ITK_TEMPLATE_EXPORT SegmentationLevelSetImageFilter
145 : public SparseFieldLevelSetImageFilter<TInputImage, Image<TOutputPixelType, TInputImage::ImageDimension>>
146{
147public:
148 ITK_DISALLOW_COPY_AND_MOVE(SegmentationLevelSetImageFilter);
149
152
153 // static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
154
157
162
164 using typename Superclass::ValueType;
165 using typename Superclass::IndexType;
166 using typename Superclass::TimeStepType;
167 using typename Superclass::InputImageType;
168
170 using FeatureImageType = TFeatureImage;
171
174
178
180 itkOverrideGetNameOfClassMacro(SegmentationLevelSetImageFilter);
181
184 void
185 SetMaximumIterations(unsigned int i)
186 {
187 itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
188 this->SetNumberOfIterations(i);
189 }
190
191
192 unsigned int
194 {
195 itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
196 return this->GetNumberOfIterations();
197 }
198
201 virtual void
203 {
204 itkDebugMacro("setting input FeatureImage to " << f);
206 {
207 this->ProcessObject::SetInput("FeatureImage", const_cast<FeatureImageType *>(f));
208 m_SegmentationFunction->SetFeatureImage(f);
209 this->Modified();
210 }
211 }
214
220
222 void
224 {
225 this->SetFeatureImage(input);
226 }
227
231 void
233 {
234 m_SegmentationFunction->SetSpeedImage(s);
235 }
236
240 void
242 {
243 m_SegmentationFunction->SetAdvectionImage(v);
244 }
245
248 virtual const SpeedImageType *
250 {
251 return m_SegmentationFunction->GetSpeedImage();
252 }
253
256 virtual const VectorImageType *
258 {
259 return m_SegmentationFunction->GetAdvectionImage();
260 }
261
265 void
267 {
268 itkWarningMacro(
269 << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
271 }
272
273
274 void
276 {
277 itkWarningMacro(
278 << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
280 }
281
284 void
286 {
287 itkWarningMacro("SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
288 if (u)
289 {
290 this->SetReverseExpansionDirection(false);
291 }
292 else
293 {
295 }
296 }
297
298
299 bool
301 {
302 itkWarningMacro(
303 << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
304 if (m_ReverseExpansionDirection == false)
305 {
306 return true;
307 }
308
309 return false;
310 }
311
320 itkSetMacro(ReverseExpansionDirection, bool);
321 itkGetConstMacro(ReverseExpansionDirection, bool);
322 itkBooleanMacro(ReverseExpansionDirection);
324
330 itkSetMacro(AutoGenerateSpeedAdvection, bool);
331 itkGetConstMacro(AutoGenerateSpeedAdvection, bool);
332 itkBooleanMacro(AutoGenerateSpeedAdvection);
334
339 void
341 {
342 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
343 {
344 this->SetPropagationScaling(v);
345 }
346 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
347 {
348 this->SetAdvectionScaling(v);
349 }
350 }
351
352
355 void
357 {
358 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
359 {
360 m_SegmentationFunction->SetPropagationWeight(v);
361 this->Modified();
362 }
363 }
364
365
366 ValueType
368 {
369 return m_SegmentationFunction->GetPropagationWeight();
370 }
371
374 void
376 {
377 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
378 {
379 m_SegmentationFunction->SetAdvectionWeight(v);
380 this->Modified();
381 }
382 }
383
384
385 ValueType
387 {
388 return m_SegmentationFunction->GetAdvectionWeight();
389 }
390
395 void
397 {
398 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetCurvatureWeight()))
399 {
400 m_SegmentationFunction->SetCurvatureWeight(v);
401 this->Modified();
402 }
403 }
404
405
406 ValueType
408 {
409 return m_SegmentationFunction->GetCurvatureWeight();
410 }
411
413 void
415 {
416 if (m_SegmentationFunction->GetUseMinimalCurvature() != b)
417 {
418 m_SegmentationFunction->SetUseMinimalCurvature(b);
419 this->Modified();
420 }
421 }
422
423
424 bool
426 {
427 return m_SegmentationFunction->GetUseMinimalCurvature();
428 }
429
430 void
432 {
433 this->SetUseMinimalCurvature(true);
434 }
435
436 void
438 {
439 this->SetUseMinimalCurvature(false);
440 }
441
447 virtual void
458
459 virtual SegmentationFunctionType *
464
469 void
471 {
472 if (n != m_SegmentationFunction->GetMaximumCurvatureTimeStep())
473 {
474 m_SegmentationFunction->SetMaximumCurvatureTimeStep(n);
475 this->Modified();
476 }
477 }
478
479
480 double
482 {
483 return m_SegmentationFunction->GetMaximumCurvatureTimeStep();
484 }
485
490 void
492 {
493 if (n != m_SegmentationFunction->GetMaximumPropagationTimeStep())
494 {
495 m_SegmentationFunction->SetMaximumPropagationTimeStep(n);
496 this->Modified();
497 }
498 }
499
500
501 double
503 {
504 return m_SegmentationFunction->GetMaximumPropagationTimeStep();
505 }
506
510 void
512
516 void
518
519 itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits<TOutputPixelType>));
520
521protected:
524
525 void
526 PrintSelf(std::ostream & os, Indent indent) const override;
527
529 void
531 {
533 // Estimate the progress of the filter
534 this->UpdateProgress(static_cast<float>(this->GetElapsedIterations()) /
535 static_cast<float>(this->GetNumberOfIterations()));
536 }
537
538
541 void
542 GenerateData() override;
543
547
553
554private:
556};
557} // end namespace itk
558
559#ifndef ITK_MANUAL_INSTANTIATION
560# include "itkSegmentationLevelSetImageFilter.hxx"
561#endif
562
563#endif
virtual const IdentifierType & GetNumberOfIterations() const
virtual void SetDifferenceFunction(FiniteDifferenceFunctionType *_arg)
virtual const IdentifierType & GetElapsedIterations() const
virtual void SetNumberOfIterations(IdentifierType _arg)
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:50
virtual void Modified() const
virtual void SetInput(const DataObjectIdentifierType &key, DataObject *input)
Protected method for setting indexed and named inputs.
void UpdateProgress(float progress)
Update the progress of the process object.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itkGetInputMacro(InitialImage, InputImageType)
virtual const SpeedImageType * GetSpeedImage() const
void PrintSelf(std::ostream &os, Indent indent) const override
SegmentationLevelSetFunction< OutputImageType, FeatureImageType > SegmentationFunctionType
virtual void SetFeatureImage(const FeatureImageType *f)
virtual const VectorImageType * GetAdvectionImage() const
virtual void SetSegmentationFunction(SegmentationFunctionType *s)
itkGetInputMacro(FeatureImage, FeatureImageType)
virtual SegmentationFunctionType * GetSegmentationFunction()
~SegmentationLevelSetImageFilter() override=default
itkSetInputMacro(InitialImage, InputImageType)
Implements transparent reference counting.
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
#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....
constexpr TContainer MakeFilled(typename TContainer::const_reference value)
TTarget itkDynamicCastInDebugMode(TSource x)