18#ifndef itkPatchBasedDenoisingImageFilter_h
19#define itkPatchBasedDenoisingImageFilter_h
35#include "ITKDenoisingExport.h"
61template <
typename TInputImage,
typename TOutputImage>
146 itkSetMacro(UseSmoothDiscPatchWeights,
bool);
147 itkBooleanMacro(UseSmoothDiscPatchWeights);
148 itkGetConstMacro(UseSmoothDiscPatchWeights,
bool);
164 itkSetClampMacro(KernelBandwidthFractionPixelsForEstimation,
double, 0.01, 1.0);
165 itkGetConstReferenceMacro(KernelBandwidthFractionPixelsForEstimation,
double);
170 itkSetMacro(ComputeConditionalDerivatives,
bool);
171 itkBooleanMacro(ComputeConditionalDerivatives);
172 itkGetConstMacro(ComputeConditionalDerivatives,
bool);
186 itkSetMacro(UseFastTensorComputations,
bool);
187 itkBooleanMacro(UseFastTensorComputations);
188 itkGetConstMacro(UseFastTensorComputations,
bool);
200 itkSetClampMacro(KernelBandwidthMultiplicationFactor,
double, 0.01, 100);
201 itkGetConstReferenceMacro(KernelBandwidthMultiplicationFactor,
double);
218 itkGetConstMacro(NumIndependentComponents,
unsigned int);
240 template <
typename T,
typename U =
void>
243 template <
typename T,
typename U =
void>
253 template <
typename T>
266 template <
typename T>
267 typename EnableIfMultiComponent<T, typename NumericTraits<T>::ValueType>::type
274 template <
typename T>
277 unsigned int itkNotUsed(idx),
283 template <
typename T>
306 template <
typename TImageType>
307 typename DisableIfMultiComponent<typename TImageType::PixelType>::type
313 template <
typename TImageType>
314 typename EnableIfMultiComponent<typename TImageType::PixelType>::type
332 bool useCachedComputations,
342 a, b, weight, useCachedComputations, cacheIndex, eigenValsCache, eigenVecsCache, diff, norm);
347 a, b, weight, useCachedComputations, cacheIndex, eigenValsCache, eigenVecsCache, diff, norm);
352 template <
typename PixelT>
357 bool useCachedComputations,
365 a, b, weight, useCachedComputations, cacheIndex, eigenValsCache, eigenVecsCache, diff, norm);
382 template <
typename RealT>
414 const int itkNotUsed(threadId),
430 typename ListAdaptorType::Pointer & inList,
466 template <
typename TInputImageType>
470 template <
typename TInputImageType>
474 template <
typename TInputImageType>
478 template <
typename TInputImageType>
489 const int itkNotUsed(threadId),
500 bool useCachedComputations,
512 bool useCachedComputations,
519 template <
typename TensorValueT>
576#ifndef ITK_MANUAL_INSTANTIATION
577# include "itkPatchBasedDenoisingImageFilter.hxx"
Array class with size defined at construction time.
Represent a diffusion tensor as used in DTI images.
Simulate a standard C array with copy semantics.
A multi-dimensional iterator templated over image type that walks a region of pixels.
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename OutputImageType::Pointer OutputImagePointer
Templated n-dimensional image class.
Control indentation during Print() invocation.
A templated class holding a M x N size Matrix.
static constexpr unsigned int ImageDimension
typename NumericTraits< PixelType >::ValueType PixelValueType
typename itk::Statistics::ImageToNeighborhoodSampleAdaptor< OutputImageType, BoundaryConditionType > ListAdaptorType
virtual ComponentSpaceEnum GetComponentSpace() const
typename ListAdaptorType::NeighborhoodRadiusType PatchRadiusType
Array< float > PatchWeightsType
TOutputImage OutputImageType
PatchBasedDenoisingBaseImageFilter()
ConstNeighborhoodIterator< InputImageType, BoundaryConditionType > InputImagePatchIterator
TInputImage InputImageType
OutputPixelType PixelType
ShortArrayType m_SigmaConverged
Array< PixelValueType > PixelArrayType
Array< RealValueType > RealArrayType
virtual void ThreadedApplyUpdate(const InputImageRegionType ®ionToProcess, const int threadId)
void DispatchedArrayMinMax(const TInputImageType *img)
virtual void EmptyCaches()
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION RiemannianMinMaxThreaderCallback(void *arg)
void Compute3x3EigenAnalysis(const DiffusionTensor3D< TensorValueT > &spdMatrix, FixedArray< TensorValueT, 3 > &eigenVals, Matrix< TensorValueT, 3, 3 > &eigenVecs)
void PrintSelf(std::ostream &os, Indent indent) const override
PatchBasedDenoisingBaseImageFilter< TInputImage, TOutputImage > Superclass
ThreadDataStruct ThreadedRiemannianMinMax(const InputImageRegionType ®ionToProcess, const int threadId, const InputImageType *img, ThreadDataStruct threadData)
virtual ThreadDataStruct ThreadedComputeSigmaUpdate(const InputImageRegionType ®ionToProcess, const int threadId, ThreadDataStruct threadData)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeImageUpdateThreaderCallback(void *arg)
typename itk::Statistics::ImageToNeighborhoodSampleAdaptor< OutputImageType, BoundaryConditionType > ListAdaptorType
double m_KernelBandwidthFractionPixelsForEstimation
void DispatchedMinMax(const TInputImageType *img)
DisableIfMultiComponent< typenameTImageType::PixelType >::type ComputeMinMax(const TImageType *img)
void ComputeDifferenceAndWeightedSquaredNorm(const DiffusionTensor3D< PixelValueType > &a, const DiffusionTensor3D< PixelValueType > &b, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &diff, RealArrayType &norm)
ListAdaptorType PatchSampleType
bool m_ComputeConditionalDerivatives
void ComputeMinMax(const Image< DiffusionTensor3D< PixelValueType >, ImageDimension > *img)
SmartPointer< const Self > ConstPointer
RealType m_NoiseSigmaSquared
RealArrayType m_IntensityRescaleInvFactor
virtual void InitializeKernelSigma()
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ApplyUpdateThreaderCallback(void *arg)
itk::Statistics::RegionConstrainedSubsampler< PatchSampleType, InputImageRegionType > BaseSamplerType
virtual ThreadDataStruct ThreadedComputeImageUpdate(const InputImageRegionType ®ionToProcess, const int threadId, ThreadDataStruct threadData)
Array< unsigned short > ShortArrayType
virtual void SetThreadData(int threadId, const ThreadDataStruct &data)
void ComputeLogMapAndWeightedSquaredGeodesicDifference(const DiffusionTensor3D< PixelValueType > &spdMatrixA, const DiffusionTensor3D< PixelValueType > &spdMatrixB, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &symMatrixLogMap, RealArrayType &geodesicDist)
void ComputeImageUpdate() override
std::vector< EigenVectorsMatrixType > EigenVectorsCacheType
PixelArrayType m_ImageMin
void PostProcessOutput() override
virtual void InitializePatchWeightsSmoothDisc()
unsigned int m_TotalNumberPixels
typename std::enable_if<!std::is_same_v< T, typename NumericTraits< T >::ValueType >, U > EnableIfMultiComponent
unsigned int m_SigmaUpdateDecimationFactor
RealType AddUpdate(const RealT &a, const RealType &b)
static constexpr unsigned int MaxSigmaUpdateIterations
DisableIfMultiComponent< T, T >::type GetComponent(const T pix, unsigned int idx) const
A method to generically get a component.
static constexpr unsigned int ImageDimension
RealArrayType m_KernelBandwidthSigma
PatchBasedDenoisingImageFilter Self
Matrix< PixelValueType, 3, 3 > EigenVectorsMatrixType
typename BaseSamplerType::Pointer BaseSamplerPointer
PatchBasedDenoisingImageFilter()
void CopyInputToOutput() override
virtual ThreadDataStruct GetThreadData(int threadId)
void ComputeKernelBandwidthUpdate() override
void InitializePatchWeights() override
void SetKernelBandwidthSigma(const RealArrayType &kernelSigma)
void InitializeIteration() override
void ApplyUpdate() override
FixedArray< PixelValueType, 3 > EigenValuesArrayType
void SetComponent(T &pix, unsigned int idx, typename DisableIfMultiComponent< T, RealValueType >::type val) const
A method to generically set a component.
RealType AddExponentialMapUpdate(const DiffusionTensor3D< RealValueType > &spdMatrix, const DiffusionTensor3D< RealValueType > &symMatrix)
virtual void ResolveRiemannianMinMax()
void ComputeDifferenceAndWeightedSquaredNorm(const PixelT &a, const PixelT &b, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &diff, RealArrayType &norm)
unsigned int m_NumPixelComponents
~PatchBasedDenoisingImageFilter() override
virtual void EnforceConstraints()
RealType AddEuclideanUpdate(const RealType &a, const RealType &b)
void ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(const PixelType &a, const PixelType &b, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &diff, RealArrayType &norm)
typename std::enable_if< std::is_same_v< T, typename NumericTraits< T >::ValueType >, U > DisableIfMultiComponent
std::vector< ThreadDataStruct > m_ThreadData
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeSigmaUpdateThreaderCallback(void *arg)
void SetComponent(T &pix, unsigned int idx, typename EnableIfMultiComponent< T, RealValueType >::type val) const
void Initialize() override
bool m_UseFastTensorComputations
EnableIfMultiComponent< T, typenameNumericTraits< T >::ValueType >::type GetComponent(const T &pix, unsigned int idx) const
typename NumericTraits< PixelValueType >::RealType RealValueType
EnableIfMultiComponent< typenameTImageType::PixelType >::type ComputeMinMax(const TImageType *img)
ImageRegionIterator< OutputImageType > OutputImageRegionIteratorType
void AllocateUpdateBuffer() override
typename InputImageType::RegionType InputImageRegionType
void SetNoiseSigma(const RealType &sigma)
bool m_UseSmoothDiscPatchWeights
TInputImage InputImageType
PixelArrayType m_ImageMax
SmartPointer< Self > Pointer
typename NumericTraits< PixelType >::RealType RealType
std::vector< EigenValuesArrayType > EigenValuesCacheType
typename BaseSamplerType::InstanceIdentifier InstanceIdentifier
bool m_KernelBandwidthSigmaIsSet
unsigned int m_NumIndependentComponents
BaseSamplerPointer m_Sampler
ImageRegionConstIterator< InputImageType > InputImageRegionConstIteratorType
double m_SigmaUpdateConvergenceTolerance
virtual RealArrayType ResolveSigmaUpdate()
double m_KernelBandwidthMultiplicationFactor
void DispatchedVectorMinMax(const TInputImageType *img)
void DispatchedRiemannianMinMax(const TInputImageType *img)
OutputImageType::Pointer m_UpdateBuffer
OutputPixelType PixelType
virtual RealType ComputeGradientJointEntropy(InstanceIdentifier id, typename ListAdaptorType::Pointer &inList, BaseSamplerPointer &sampler, ThreadDataStruct &threadData)
void GenerateInputRequestedRegion() override
ListAdaptorType::Pointer m_SearchSpaceList
RealType AddUpdate(const DiffusionTensor3D< RealValueType > &a, const RealType &b)
Implements transparent reference counting.
This an abstract subsampler that constrains subsamples to be contained within a given image region.
SmartPointer< Self > Pointer
typename PatchSampleType::InstanceIdentifier InstanceIdentifier
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
RealArrayType entropySecondDerivative
EigenValuesCacheType eigenValsCache
BaseSamplerPointer sampler
ShortArrayType validDerivatives
EigenVectorsCacheType eigenVecsCache
ShortArrayType validNorms
RealArrayType entropyFirstDerivative
PatchBasedDenoisingImageFilter * Filter