18 #ifndef itkPatchBasedDenoisingImageFilter_h
19 #define itkPatchBasedDenoisingImageFilter_h
60 template <
typename TInputImage,
typename TOutputImage>
144 itkSetMacro(UseSmoothDiscPatchWeights,
bool);
145 itkBooleanMacro(UseSmoothDiscPatchWeights);
146 itkGetConstMacro(UseSmoothDiscPatchWeights,
bool);
161 itkSetClampMacro(KernelBandwidthFractionPixelsForEstimation,
double, 0.01, 1.0);
162 itkGetConstReferenceMacro(KernelBandwidthFractionPixelsForEstimation,
double);
167 itkSetMacro(ComputeConditionalDerivatives,
bool);
168 itkBooleanMacro(ComputeConditionalDerivatives);
169 itkGetConstMacro(ComputeConditionalDerivatives,
bool);
185 itkSetMacro(UseFastTensorComputations,
bool);
186 itkBooleanMacro(UseFastTensorComputations);
187 itkGetConstMacro(UseFastTensorComputations,
bool);
200 itkSetClampMacro(KernelBandwidthMultiplicationFactor,
double, 0.01, 100);
201 itkGetConstReferenceMacro(KernelBandwidthMultiplicationFactor,
double);
209 itkGetConstMacro(NoiseSigma,
RealType);
219 virtual void PrintSelf(std::ostream& os,
Indent indent)
const ITK_OVERRIDE;
237 template< typename T>
242 unsigned int itkNotUsed( idx ) )
const
253 template<
typename T>
255 IsSame<T, typename NumericTraits<T>::ValueType>::Value,
258 unsigned int idx )
const
264 template<
typename T >
267 unsigned int itkNotUsed( idx ),
268 typename EnableIfC< IsSame<T,
274 template<
typename T >
300 template<
typename TImageType>
302 IsSame<typename TImageType::PixelType, typename NumericTraits<typename TImageType::PixelType>::ValueType>::Value
309 template<
typename TImageType>
311 IsSame<typename TImageType::PixelType, typename NumericTraits<typename TImageType::PixelType>::ValueType>::Value
329 bool useCachedComputations,
338 useCachedComputations, cacheIndex,
339 eigenValsCache, eigenVecsCache,
345 useCachedComputations, cacheIndex,
346 eigenValsCache, eigenVecsCache,
352 template <
typename PixelT>
356 bool useCachedComputations,
363 useCachedComputations, cacheIndex,
364 eigenValsCache, eigenVecsCache,
385 template <
typename RealT>
409 const
int itkNotUsed(threadId),
410 ThreadDataStruct threadData);
418 ThreadDataStruct threadData);
423 ThreadDataStruct& threadData);
428 const
int itkNotUsed(threadId) );
432 virtual
void SetThreadData(
int threadId, const ThreadDataStruct& data);
473 void operator=(const
Self&) ITK_DELETE_FUNCTION;
487 template <typename TInputImageType>
490 template <typename TInputImageType>
493 template <typename TInputImageType>
496 template <typename TInputImageType>
504 const
int itkNotUsed(threadId),
512 bool useCachedComputations,
522 bool useCachedComputations,
528 template <typename TensorValueT>
531 Matrix< TensorValueT, 3, 3 >& eigenVecs);
549 #ifndef ITK_MANUAL_INSTANTIATION
550 # include "itkPatchBasedDenoisingImageFilter.hxx"
ListAdaptorType::Pointer m_SearchSpaceList
unsigned int m_TotalNumberPixels
A templated class holding a M x N size Matrix.
Derived class implementing a specific patch-based denoising algorithm, as detailed below...
PatchBasedDenoisingImageFilter * Filter
Array< RealValueType > RealArrayType
virtual ThreadDataStruct ThreadedComputeSigmaUpdate(const InputImageRegionType ®ionToProcess, const int, ThreadDataStruct threadData)
BaseSamplerPointer m_Sampler
BaseSamplerType::InstanceIdentifier InstanceIdentifier
Superclass::OutputImageType OutputImageType
RealArrayType entropyFirstDerivative
BaseSamplerType::Pointer BaseSamplerPointer
void ComputeDifferenceAndWeightedSquaredNorm(const PixelT &a, const PixelT &b, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &diff, RealArrayType &norm)
static const unsigned int MaxSigmaUpdateIterations
OutputImageType::Pointer m_UpdateBuffer
ConstNeighborhoodIterator< InputImageType, BoundaryConditionType > InputImagePatchIterator
Superclass::InputImagePatchIterator InputImagePatchIterator
virtual void EmptyCaches()
Base class for patch-based denoising algorithms.
DisableIfC< IsSame< T, typename NumericTraits< T >::ValueType >::Value, typename NumericTraits< T >::ValueType >::Type GetComponent(const T &pix, unsigned int idx) const
void DispatchedRiemannianMinMax(const TInputImageType *img)
RealArrayType m_IntensityRescaleInvFactor
virtual void InitializeKernelSigma()
bool m_UseFastTensorComputations
double m_KernelBandwidthMultiplicationFactor
static ITK_THREAD_RETURN_TYPE RiemannianMinMaxThreaderCallback(void *arg)
double m_SigmaUpdateConvergenceTolerance
virtual void CopyInputToOutput() override
RealType AddEuclideanUpdate(const RealType &a, const RealType &b)
std::vector< EigenVectorsMatrixType > EigenVectorsCacheType
Superclass::PixelValueType PixelValueType
ThreadDataStruct ThreadedRiemannianMinMax(const InputImageRegionType ®ionToProcess, const int, const InputImageType *img, ThreadDataStruct threadData)
virtual void ApplyUpdate() override
TInputImage InputImageType
Base class for all process objects that output image data.
virtual ThreadDataStruct ThreadedComputeImageUpdate(const InputImageRegionType ®ionToProcess, const int threadId, ThreadDataStruct threadData)
unsigned long SizeValueType
EigenValuesCacheType eigenValsCache
RealArrayType m_KernelBandwidthSigma
#define ITK_THREAD_RETURN_TYPE
unsigned int m_NumIndependentComponents
static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback(void *arg)
Superclass::PatchWeightsType PatchWeightsType
RealType AddExponentialMapUpdate(const DiffusionTensor3D< RealValueType > &spdMatrix, const DiffusionTensor3D< RealValueType > &symMatrix)
Simulate a standard C array with copy semnatics.
Superclass::PixelType PixelType
OutputPixelType PixelType
PixelArrayType m_ImageMin
virtual void InitializePatchWeights() override
std::vector< EigenValuesArrayType > EigenValuesCacheType
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 SetKernelBandwidthSigma(const RealArrayType &kernelSigma)
PatchBasedDenoisingBaseImageFilter< TInputImage, TOutputImage > Superclass
static const unsigned int ImageDimension
TOutputImage OutputImageType
RealType AddUpdate(const DiffusionTensor3D< RealValueType > &a, const RealType &b)
typename::itk::Statistics::ImageToNeighborhoodSampleAdaptor< OutputImageType, BoundaryConditionType > ListAdaptorType
bool m_ComputeConditionalDerivatives
virtual RealArrayType ResolveSigmaUpdate()
Superclass::OutputImagePointer OutputImagePointer
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Array< unsigned short > ShortArrayType
EigenVectorsCacheType eigenVecsCache
OutputImageType::Pointer OutputImagePointer
virtual void ComputeKernelBandwidthUpdate() override
TSample::InstanceIdentifier InstanceIdentifier
Superclass::PatchRadiusType PatchRadiusType
void DispatchedArrayMinMax(const TInputImageType *img)
void ComputeMinMax(const Image< DiffusionTensor3D< PixelValueType >, ImageDimension > *img)
InputImageType::RegionType InputImageRegionType
~PatchBasedDenoisingImageFilter()
virtual void Initialize() override
This an abstract subsampler that constrains subsamples to be contained within a given image region...
A multi-dimensional iterator templated over image type that walks a region of pixels.
RealType m_NoiseSigmaSquared
virtual void SetThreadData(int threadId, const ThreadDataStruct &data)
TInputImage InputImageType
void SetNoiseSigma(const RealType &sigma)
static ITK_THREAD_RETURN_TYPE ComputeSigmaUpdateThreaderCallback(void *arg)
void SetComponent(T &pix, unsigned int, typename EnableIfC< IsSame< T, typename NumericTraits< T >::ValueType >::Value, RealValueType >::Type val) const
A method to generically set a component.
virtual void ResolveRiemannianMinMax()
SmartPointer< const Self > ConstPointer
ShortArrayType validDerivatives
virtual void ThreadedApplyUpdate(const InputImageRegionType ®ionToProcess, const int)
virtual void AllocateUpdateBuffer() override
ComponentSpaceType m_ComponentSpace
virtual ThreadDataStruct GetThreadData(int threadId)
SmartPointer< Self > Pointer
void DispatchedMinMax(const TInputImageType *img)
Array< PixelValueType > PixelArrayType
BaseSamplerPointer sampler
Superclass::ListAdaptorType ListAdaptorType
Superclass::InputImageType InputImageType
std::vector< ThreadDataStruct > m_ThreadData
FixedArray< PixelValueType, 3 > EigenValuesArrayType
void ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(const PixelType &a, const PixelType &b, const RealArrayType &weight, bool useCachedComputations, SizeValueType cacheIndex, EigenValuesCacheType &eigenValsCache, EigenVectorsCacheType &eigenVecsCache, RealType &diff, RealArrayType &norm)
Matrix< PixelValueType, 3, 3 > EigenVectorsMatrixType
void SetComponent(T &pix, unsigned int idx, typename DisableIfC< IsSame< T, typename NumericTraits< T >::ValueType >::Value, RealValueType >::Type val) const
RealArrayType entropySecondDerivative
virtual RealType ComputeGradientJointEntropy(InstanceIdentifier id, typename ListAdaptorType::Pointer &inList, BaseSamplerPointer &sampler, ThreadDataStruct &threadData)
NumericTraits< PixelType >::RealType RealType
EnableIfC< IsSame< T, typename NumericTraits< T >::ValueType >::Value, T >::Type GetComponent(const T pix, unsigned int) const
A method to generically get a component.
void DispatchedVectorMinMax(const TInputImageType *img)
virtual void ComputeImageUpdate() override
void Compute3x3EigenAnalysis(const DiffusionTensor3D< TensorValueT > &spdMatrix, FixedArray< TensorValueT, 3 > &eigenVals, Matrix< TensorValueT, 3, 3 > &eigenVecs)
Base class for filters that take an image as input and produce an image as output.
ImageRegionIterator< OutputImageType > OutputImageRegionIteratorType
ShortArrayType validNorms
virtual void InitializePatchWeightsSmoothDisc()
bool m_KernelBandwidthSigmaIsSet
NumericTraits< PixelValueType >::RealType RealValueType
virtual void InitializeIteration() override
static ITK_THREAD_RETURN_TYPE ComputeImageUpdateThreaderCallback(void *arg)
ImageRegionConstIterator< InputImageType > InputImageRegionConstIteratorType
Control indentation during Print() invocation.
PatchBasedDenoisingImageFilter Self
ListAdaptorType PatchSampleType
Array< float > PatchWeightsType
ShortArrayType m_SigmaConverged
InputImageType::RegionType InputImageRegionType
unsigned int m_NumPixelComponents
Define additional traits for native types such as int or float.
virtual void PostProcessOutput() override
PixelArrayType m_ImageMax
EnableIfC< IsSame< typename TImageType::PixelType, typename NumericTraits< typename TImageType::PixelType >::ValueType >::Value >::Type ComputeMinMax(const TImageType *img)
TOutputImage OutputImageType
static const unsigned int ImageDimension
PatchBasedDenoisingImageFilter()
DisableIfC< IsSame< typename TImageType::PixelType, typename NumericTraits< typename TImageType::PixelType >::ValueType >::Value >::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)
bool m_UseSmoothDiscPatchWeights
Represent a diffusion tensor as used in DTI images.
NumericTraits< PixelType >::ValueType PixelValueType
virtual void EnforceConstraints()
ListAdaptorType::NeighborhoodRadiusType PatchRadiusType
An implementation of the negation of the enable if idiom.
Templated n-dimensional image class.
A multi-dimensional iterator templated over image type that walks a region of pixels.
itk::Statistics::RegionConstrainedSubsampler< PatchSampleType, InputImageRegionType > BaseSamplerType
unsigned int m_SigmaUpdateDecimationFactor
virtual void GenerateInputRequestedRegion() override
double m_KernelBandwidthFractionPixelsForEstimation
RealType AddUpdate(const RealT &a, const RealType &b)