18 #ifndef __itkMRIBiasFieldCorrectionFilter_h
19 #define __itkMRIBiasFieldCorrectionFilter_h
46 template<
typename TImage,
typename TImageMask,
typename TBiasField >
148 virtual ~MRIBiasEnergyFunction();
170 MRIBiasEnergyFunction(const
Self &);
171 void operator=(const Self &);
224 template< typename TInputImage, typename TOutputImage, typename TMaskImage >
242 itkStaticConstMacro(ImageDimension,
unsigned int,
243 TOutputImage::ImageDimension);
281 typedef MRIBiasEnergyFunction< InternalImageType,
298 void SetInputMask(ImageMaskType *inputMask);
299 itkGetModifiableObjectMacro(InputMask, ImageMaskType);
304 void SetOutputMask(ImageMaskType *outputMask);
305 itkGetModifiableObjectMacro(OutputMask, ImageMaskType);
312 { m_BiasMultiplicative = flag; }
316 {
return m_BiasMultiplicative; }
321 itkSetMacro(UsingInterSliceIntensityCorrection,
bool);
322 itkGetConstReferenceMacro(UsingInterSliceIntensityCorrection,
bool);
330 itkSetMacro(UsingSlabIdentification,
bool);
331 itkGetConstReferenceMacro(UsingSlabIdentification,
bool);
334 itkSetMacro(SlabBackgroundMinimumThreshold, InputImagePixelType);
335 itkGetConstReferenceMacro(SlabBackgroundMinimumThreshold,
336 InputImagePixelType);
338 itkSetMacro(SlabNumberOfSamples,
unsigned int);
339 itkGetConstReferenceMacro(SlabNumberOfSamples,
unsigned int);
341 itkSetMacro(SlabTolerance,
double);
342 itkGetConstReferenceMacro(SlabTolerance,
double);
349 itkSetMacro(UsingBiasFieldCorrection,
bool);
350 itkGetConstReferenceMacro(UsingBiasFieldCorrection,
bool);
355 itkSetMacro(GeneratingOutput,
bool);
356 itkGetConstReferenceMacro(GeneratingOutput,
bool);
361 itkSetMacro(SlicingDirection,
int);
364 itkSetMacro(BiasFieldDegree,
int);
365 itkGetConstMacro(BiasFieldDegree,
int);
373 { this->
Modified(); m_BiasFieldCoefficients = coefficients; }
379 {
return m_EstimatedBiasFieldCoefficients; }
389 itkSetMacro(VolumeCorrectionMaximumIteration,
int);
390 itkGetConstMacro(VolumeCorrectionMaximumIteration,
int);
391 itkSetMacro(InterSliceCorrectionMaximumIteration,
int);
392 itkGetConstMacro(InterSliceCorrectionMaximumIteration,
int);
397 { m_OptimizerInitialRadius = initRadius; }
399 {
return m_OptimizerInitialRadius; }
403 itkSetMacro(OptimizerGrowthFactor,
double);
404 itkGetConstMacro(OptimizerGrowthFactor,
double);
409 itkSetMacro(OptimizerShrinkFactor,
double);
410 itkGetConstMacro(OptimizerShrinkFactor,
double);
418 void SetNumberOfLevels(
unsigned int num);
421 itkGetConstMacro(NumberOfLevels,
unsigned int);
429 void SetSchedule(
const ScheduleType & schedule);
432 itkGetConstReferenceMacro(Schedule, ScheduleType);
438 void SetStartingShrinkFactors(
unsigned int factor);
440 void SetStartingShrinkFactors(
unsigned int *factors);
443 const unsigned int * GetStartingShrinkFactors()
const;
448 static bool IsScheduleDownwardDivisible(
const ScheduleType & schedule);
461 BiasFieldType EstimateBiasField(InputImageRegionType region,
463 int maximumIteration);
468 void CorrectImage(BiasFieldType & bias,
469 InputImageRegionType region);
473 void CorrectInterSliceIntensityInhomogeneity(InputImageRegionType region);
477 virtual ~MRIBiasFieldCorrectionFilter();
482 bool CheckMaskImage(ImageMaskType *mask);
488 void Log1PImage(InternalImageType *source,
489 InternalImageType *target);
493 void ExpImage(InternalImageType *source,
494 InternalImageType *target);
498 template< typename TSource, typename TTarget >
499 void CopyAndConvertImage(const TSource *source,
501 typename TTarget::RegionType requestedRegion)
505 typedef typename TTarget::PixelType TargetPixelType;
507 SourceIterator s_iter(source, requestedRegion);
508 TargetIterator t_iter(target, requestedRegion);
512 while ( !s_iter.IsAtEnd() )
514 t_iter.Set( static_cast< TargetPixelType >( s_iter.Get() ) );
524 void GetBiasFieldSize(InputImageRegionType region,
525 BiasFieldType::DomainSizeType & domainSize);
530 void AdjustSlabRegions(SlabRegionVectorType & slabs,
531 OutputImageRegionType requestedRegion);
614 #ifndef ITK_MANUAL_INSTANTIATION
615 #include "itkMRIBiasFieldCorrectionFilter.hxx"
MultivariateLegendrePolynomial BiasFieldType
Array class with size defined at construction time.
Superclass::MeasureType MeasureType
Superclass::RegionType RegionType
Superclass::DerivativeType DerivativeType
SmartPointer< const Self > ConstPointer
SingleValuedCostFunction Superclass
void GetDerivative(const ParametersType &, DerivativeType &) const ITK_OVERRIDE
InternalImageType::PixelType InternalImagePixelType
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
TOutputImage::PixelType OutputImagePixelType
NormalVariateGeneratorType::Pointer m_NormalVariateGenerator
TOutputImage::RegionType OutputImageRegionType
bool m_UsingBiasFieldCorrection
void InitializeDistributions(Array< double > classMeans, Array< double > classSigmas)
InternalImageType::RegionType InternalImageRegionType
MaskType::Pointer MaskPointer
TOutputImage::SizeType OutputImageSizeType
Array< double > m_TissueClassMeans
ImageMaskType::Pointer ImageMaskPointer
void IsBiasFieldMultiplicative(bool flag)
Array< double > m_TissueClassSigmas
bool m_BiasMultiplicative
TOutputImage::Pointer OutputImagePointer
ImageMaskType::RegionType ImageMaskRegionType
double GetOptimizerInitialRadius()
CompositeValleyFunction InternalEnergyFunction
unsigned int SamplingFactorType[SpaceDimension]
ImageMaskPointer m_InputMask
EnergyFunctionType::Pointer EnergyFunctionPointer
virtual MeasureType GetValue(const ParametersType ¶meters) const ITK_OVERRIDE
double GetEnergy0(double diff)
std::vector< ImageRegionType > SlabRegionVectorType
ImageType::Pointer ImagePointer
ImageType::IndexType ImageIndexType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
unsigned int m_SlabNumberOfSamples
Superclass::ParametersType ParametersType
MRIBiasEnergyFunction< InternalImageType, ImageMaskType, BiasFieldType > EnergyFunctionType
SmartPointer< Self > Pointer
InternalImagePointer m_InternalInput
BiasFieldType::CoefficientArrayType GetEstimatedBiasFieldCoefficients()
TOutputImage OutputImageType
EnergyFunctionPointer m_EnergyFunction
InputImagePixelType m_SlabBackgroundMinimumThreshold
void SetBiasField(BiasFieldType *bias)
ImageType::RegionType ImageRegionType
MaskType::PixelType MaskElementType
Image< float, itkGetStaticConstMacro(ImageDimension) > InternalImageType
Array< ParametersValueType > DerivativeType
int m_InterSliceCorrectionMaximumIteration
BiasFieldType::CoefficientArrayType m_BiasFieldCoefficients
double m_OptimizerShrinkFactor
ImageType::PixelType ImageElementType
A multi-dimensional iterator templated over image type that walks a region of pixels.
MRIBiasEnergyFunction Self
void SetOptimizerInitialRadius(double initRadius)
InternalEnergyFunction * m_InternalEnergyFunction
a cost function for optimization
2D and 3D multivariate Legendre Polynomial
bool m_UsingInterSliceIntensityCorrection
Standard exception handling object.
static const unsigned int SpaceDimension
A region represents some portion or piece of data.
virtual void Modified() const
SmartPointer< Self > Pointer
Superclass::ParametersType ParametersType
identifies slab in MR images comparing minimum intensity averages
1+1 evolutionary strategy optimizer
bool IsBiasFieldMultiplicative()
TInputImage::SizeType InputImageSizeType
double m_OptimizerInitialRadius
SmartPointer< const Self > ConstPointer
ImageMaskPointer m_OutputMask
MRIBiasFieldCorrectionFilter Self
unsigned int m_NumberOfLevels
OnePlusOneEvolutionaryOptimizer OptimizerType
Base class for filters that take an image as input and produce an image as output.
Statistics::NormalVariateGenerator NormalVariateGeneratorType
void SetSamplingFactors(SamplingFactorType factor)
bool m_UsingSlabIdentification
Control indentation during Print() invocation.
DoubleArrayType CoefficientArrayType
corrects 3D MRI bias field
SamplingFactorType m_SamplingFactor
InternalImageType::Pointer InternalImagePointer
TOutputImage::IndexType OutputImageIndexType
void operator=(const Self &)
MRASlabIdentifierType::SlabRegionVectorType SlabRegionVectorType
Array2D< unsigned int > ScheduleType
SlabRegionVectorType m_Slabs
SlabRegionVectorType::iterator SlabRegionVectorIteratorType
TInputImage::IndexType InputImageIndexType
MRASlabIdentifier< InputImageType > MRASlabIdentifierType
TInputImage InputImageType
TInputImage::PixelType InputImagePixelType
TInputImage::RegionType InputImageRegionType
BiasFieldType::CoefficientArrayType m_EstimatedBiasFieldCoefficients
int m_VolumeCorrectionMaximumIteration
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
void SetInitialBiasFieldCoefficients(const BiasFieldType::CoefficientArrayType &coefficients)
double m_OptimizerGrowthFactor
Templated n-dimensional image class.
A multi-dimensional iterator templated over image type that walks a region of pixels.
Normal random variate generator.
TInputImage::Pointer InputImagePointer
virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE
BiasFieldType * m_BiasField