18 #ifndef itkN4BiasFieldCorrectionImageFilter_h
19 #define itkN4BiasFieldCorrectionImageFilter_h
28 #include "vnl/vnl_vector.h"
93 template <
typename TInputImage,
94 typename TMaskImage = Image<unsigned char, TInputImage::ImageDimension>,
95 class TOutputImage = TInputImage>
114 static constexpr
unsigned int ImageDimension = TInputImage::ImageDimension;
141 EnlargeOutputRequestedRegion(
DataObject *)
override;
149 this->SetInput(image);
157 itkSetInputMacro(MaskImage, MaskImageType);
161 this->SetMaskImage(mask);
170 itkGetInputMacro(MaskImage, MaskImageType);
180 itkSetMacro(MaskLabel, MaskPixelType);
181 itkGetConstMacro(MaskLabel, MaskPixelType);
187 itkSetMacro(UseMaskLabel,
bool);
188 itkGetConstMacro(UseMaskLabel,
bool);
189 itkBooleanMacro(UseMaskLabel);
202 itkSetInputMacro(ConfidenceImage, RealImageType);
206 this->SetConfidenceImage(image);
220 itkGetInputMacro(ConfidenceImage, RealImageType);
231 itkSetMacro(NumberOfHistogramBins,
unsigned int);
237 itkGetConstMacro(NumberOfHistogramBins,
unsigned int);
242 itkSetMacro(WienerFilterNoise, RealType);
247 itkGetConstMacro(WienerFilterNoise, RealType);
253 itkSetMacro(BiasFieldFullWidthAtHalfMaximum, RealType);
259 itkGetConstMacro(BiasFieldFullWidthAtHalfMaximum, RealType);
266 itkSetMacro(SplineOrder,
unsigned int);
271 itkGetConstMacro(SplineOrder,
unsigned int);
280 itkSetMacro(NumberOfControlPoints, ArrayType);
289 itkGetConstMacro(NumberOfControlPoints, ArrayType);
297 itkSetMacro(NumberOfFittingLevels, ArrayType);
308 auto nlevels = MakeFilled<ArrayType>(n);
309 this->SetNumberOfFittingLevels(nlevels);
319 itkGetConstMacro(NumberOfFittingLevels, ArrayType);
325 itkSetMacro(MaximumNumberOfIterations, VariableSizeArrayType);
331 itkGetConstMacro(MaximumNumberOfIterations, VariableSizeArrayType);
340 itkSetMacro(ConvergenceThreshold, RealType);
349 itkGetConstMacro(ConvergenceThreshold, RealType);
360 itkGetConstObjectMacro(LogBiasFieldControlPointLattice, BiasFieldControlPointLatticeType);
366 itkGetConstMacro(ElapsedIterations,
unsigned int);
372 itkGetConstMacro(CurrentConvergenceMeasurement, RealType);
378 itkGetConstMacro(CurrentLevel,
unsigned int);
384 ReconstructBiasField(
const BiasFieldControlPointLatticeType *);
390 PrintSelf(std::ostream & os,
Indent indent)
const override;
393 GenerateData()
override;
410 SharpenImage(
const RealImageType * unsharpenedImage, RealImageType * sharpenedImage)
const;
418 UpdateBiasFieldEstimate(RealImageType *,
size_t);
425 CalculateConvergenceMeasurement(
const RealImageType *,
const RealImageType *)
const;
428 bool m_UseMaskLabel{
false };
432 unsigned int m_NumberOfHistogramBins{ 200 };
433 RealType m_WienerFilterNoise{ static_cast<RealType>(0.01) };
434 RealType m_BiasFieldFullWidthAtHalfMaximum{ static_cast<RealType>(0.15) };
439 unsigned int m_ElapsedIterations{ 0 };
440 RealType m_ConvergenceThreshold{ static_cast<RealType>(0.001) };
442 unsigned int m_CurrentLevel{ 0 };
448 unsigned int m_SplineOrder{ 3 };
455 #ifndef ITK_MANUAL_INSTANTIATION
456 # include "itkN4BiasFieldCorrectionImageFilter.hxx"