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
185 void
186 SetMaximumIterations(unsigned int i)
187 {
188 itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
189 this->SetNumberOfIterations(i);
190 }
191
192 unsigned int
194 {
195 itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
196 return this->GetNumberOfIterations();
197 }
198
199
203 virtual void
205 {
206 itkDebugMacro("setting input FeatureImage to " << f);
208 {
209 this->ProcessObject::SetInput("FeatureImage", const_cast<FeatureImageType *>(f));
210 m_SegmentationFunction->SetFeatureImage(f);
211 this->Modified();
212 }
213 }
216
223
225 void
227 {
228 this->SetFeatureImage(input);
229 }
230
234 void
236 {
237 m_SegmentationFunction->SetSpeedImage(s);
238 }
239
243 void
245 {
246 m_SegmentationFunction->SetAdvectionImage(v);
247 }
248
251 virtual const SpeedImageType *
253 {
254 return m_SegmentationFunction->GetSpeedImage();
255 }
256
259 virtual const VectorImageType *
261 {
262 return m_SegmentationFunction->GetAdvectionImage();
263 }
264
269 void
271 {
272 itkWarningMacro(
273 << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
275 }
276
277 void
279 {
280 itkWarningMacro(
281 << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
283 }
284
285
289 void
291 {
292 itkWarningMacro("SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
293 if (u)
294 {
295 this->SetReverseExpansionDirection(false);
296 }
297 else
298 {
300 }
301 }
302
303 bool
305 {
306 itkWarningMacro(
307 << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
308 if (m_ReverseExpansionDirection == false)
309 {
310 return true;
311 }
312
313 return false;
314 }
315
316
326 itkSetMacro(ReverseExpansionDirection, bool);
327 itkGetConstMacro(ReverseExpansionDirection, bool);
328 itkBooleanMacro(ReverseExpansionDirection);
330
337 itkSetMacro(AutoGenerateSpeedAdvection, bool);
338 itkGetConstMacro(AutoGenerateSpeedAdvection, bool);
339 itkBooleanMacro(AutoGenerateSpeedAdvection);
341
346 void
348 {
349 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
350 {
351 this->SetPropagationScaling(v);
352 }
353 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
354 {
355 this->SetAdvectionScaling(v);
356 }
357 }
358
362 void
364 {
365 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
366 {
367 m_SegmentationFunction->SetPropagationWeight(v);
368 this->Modified();
369 }
370 }
371
372 ValueType
374 {
375 return m_SegmentationFunction->GetPropagationWeight();
376 }
377
378
382 void
384 {
385 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
386 {
387 m_SegmentationFunction->SetAdvectionWeight(v);
388 this->Modified();
389 }
390 }
391
392 ValueType
394 {
395 return m_SegmentationFunction->GetAdvectionWeight();
396 }
397
398
404 void
406 {
407 if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetCurvatureWeight()))
408 {
409 m_SegmentationFunction->SetCurvatureWeight(v);
410 this->Modified();
411 }
412 }
413
414 ValueType
416 {
417 return m_SegmentationFunction->GetCurvatureWeight();
418 }
419
420
423 void
425 {
426 if (m_SegmentationFunction->GetUseMinimalCurvature() != b)
427 {
428 m_SegmentationFunction->SetUseMinimalCurvature(b);
429 this->Modified();
430 }
431 }
432
433 bool
435 {
436 return m_SegmentationFunction->GetUseMinimalCurvature();
437 }
438
439
440 void
442 {
443 this->SetUseMinimalCurvature(true);
444 }
445
446 void
448 {
449 this->SetUseMinimalCurvature(false);
450 }
451
457 virtual void
468
469 virtual SegmentationFunctionType *
474
480 void
482 {
483 if (n != m_SegmentationFunction->GetMaximumCurvatureTimeStep())
484 {
485 m_SegmentationFunction->SetMaximumCurvatureTimeStep(n);
486 this->Modified();
487 }
488 }
489
490 double
492 {
493 return m_SegmentationFunction->GetMaximumCurvatureTimeStep();
494 }
495
496
502 void
504 {
505 if (n != m_SegmentationFunction->GetMaximumPropagationTimeStep())
506 {
507 m_SegmentationFunction->SetMaximumPropagationTimeStep(n);
508 this->Modified();
509 }
510 }
511 double
512
514 {
515 return m_SegmentationFunction->GetMaximumPropagationTimeStep();
516 }
517
518
522 void
524
528 void
530
531 itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits<TOutputPixelType>));
532
533protected:
536
537 void
538 PrintSelf(std::ostream & os, Indent indent) const override;
539
541 void
543 {
545 // Estimate the progress of the filter
546 this->UpdateProgress(static_cast<float>(this->GetElapsedIterations()) /
547 static_cast<float>(this->GetNumberOfIterations()));
548 }
549
552 void
553 GenerateData() override;
554
558
564
565private:
567};
568} // end namespace itk
569
570#ifndef ITK_MANUAL_INSTANTIATION
571# include "itkSegmentationLevelSetImageFilter.hxx"
572#endif
573
574#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:730
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
constexpr TContainer MakeFilled(typename TContainer::const_reference value)
TTarget itkDynamicCastInDebugMode(TSource x)