18 #ifndef __itkPatchBasedDenoisingImageFilter_h
19 #define __itkPatchBasedDenoisingImageFilter_h
62 template <
class TInputImage,
class TOutputImage>
85 itkStaticConstMacro(ImageDimension,
unsigned int,
86 Superclass::ImageDimension);
146 itkSetMacro(UseSmoothDiscPatchWeights,
bool);
147 itkBooleanMacro(UseSmoothDiscPatchWeights);
148 itkGetConstMacro(UseSmoothDiscPatchWeights,
bool);
155 void SetKernelBandwidthSigma(
const RealArrayType& kernelSigma);
163 itkSetClampMacro(KernelBandwidthFractionPixelsForEstimation,
double, 0.01, 1.0);
164 itkGetConstReferenceMacro(KernelBandwidthFractionPixelsForEstimation,
double);
169 itkSetMacro(ComputeConditionalDerivatives,
bool);
170 itkBooleanMacro(ComputeConditionalDerivatives);
171 itkGetConstMacro(ComputeConditionalDerivatives,
bool);
187 itkSetMacro(UseFastTensorComputations,
bool);
188 itkBooleanMacro(UseFastTensorComputations);
189 itkGetConstMacro(UseFastTensorComputations,
bool);
193 itkStaticConstMacro(MaxSigmaUpdateIterations,
unsigned int,
202 itkSetClampMacro(KernelBandwidthMultiplicationFactor,
double, 0.01, 100);
203 itkGetConstReferenceMacro(KernelBandwidthMultiplicationFactor,
double);
209 void SetNoiseSigma(
const RealType& sigma);
211 itkGetConstMacro(NoiseSigma,
RealType);
221 virtual void PrintSelf(std::ostream& os,
Indent indent)
const;
224 virtual void EmptyCaches();
227 virtual void AllocateUpdateBuffer();
229 virtual void CopyInputToOutput();
231 virtual void GenerateInputRequestedRegion();
239 template<
typename T>
241 IsSame<T, typename NumericTraits<T>::ValueType>::Value,
243 GetComponent(
const T pix,
244 unsigned int itkNotUsed( idx ) )
const
255 template<
typename T>
257 IsSame<T, typename NumericTraits<T>::ValueType>::Value,
259 GetComponent(
const T& pix,
260 unsigned int idx )
const
266 template<
typename T >
268 SetComponent( T &pix,
269 unsigned int itkNotUsed( idx ),
276 template<
typename T >
278 SetComponent( T &pix,
292 if (this->m_ComponentSpace == Superclass::RIEMANNIAN)
294 DispatchedRiemannianMinMax(img);
298 DispatchedArrayMinMax(img);
302 template<
typename TImageType>
304 IsSame<typename TImageType::PixelType, typename NumericTraits<typename TImageType::PixelType>::ValueType>::Value
306 ComputeMinMax(
const TImageType* img)
308 DispatchedMinMax(img);
311 template<
typename TImageType>
313 IsSame<typename TImageType::PixelType, typename NumericTraits<typename TImageType::PixelType>::ValueType>::Value
315 ComputeMinMax(
const TImageType* img)
317 DispatchedArrayMinMax(img);
331 bool useCachedComputations,
337 if (this->m_ComponentSpace == Superclass::RIEMANNIAN)
339 ComputeLogMapAndWeightedSquaredGeodesicDifference(a, b, weight,
340 useCachedComputations, cacheIndex,
341 eigenValsCache, eigenVecsCache,
346 ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(a, b, weight,
347 useCachedComputations, cacheIndex,
348 eigenValsCache, eigenVecsCache,
354 template <
class PixelT>
355 void ComputeDifferenceAndWeightedSquaredNorm(
const PixelT& a,
358 bool useCachedComputations,
364 ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(a, b, weight,
365 useCachedComputations, cacheIndex,
366 eigenValsCache, eigenVecsCache,
376 if (this->m_ComponentSpace == Superclass::RIEMANNIAN)
378 return this->AddExponentialMapUpdate(a, b);
382 return this->AddEuclideanUpdate(a, b);
387 template <
class RealT>
391 return this->AddEuclideanUpdate(a, b);
394 virtual void EnforceConstraints();
396 virtual void Initialize();
398 virtual void InitializeKernelSigma();
400 virtual void InitializePatchWeights();
402 virtual void InitializePatchWeightsSmoothDisc();
404 virtual void InitializeIteration();
406 virtual void ComputeKernelBandwidthUpdate();
410 virtual ThreadDataStruct ThreadedComputeSigmaUpdate(
const InputImageRegionType& regionToProcess,
411 const int itkNotUsed(threadId),
412 ThreadDataStruct threadData);
414 virtual RealArrayType ResolveSigmaUpdate();
416 virtual void ComputeImageUpdate();
418 virtual ThreadDataStruct ThreadedComputeImageUpdate(
const InputImageRegionType& regionToProcess,
420 ThreadDataStruct threadData);
422 virtual RealType ComputeGradientJointEntropy(InstanceIdentifier
id,
423 typename ListAdaptorType::Pointer& inList,
424 BaseSamplerPointer& sampler,
425 ThreadDataStruct& threadData);
427 virtual void ApplyUpdate();
429 virtual void ThreadedApplyUpdate(
const InputImageRegionType& regionToProcess,
430 const int itkNotUsed(threadId) );
432 virtual void PostProcessOutput();
434 virtual void SetThreadData(
int threadId,
const ThreadDataStruct& data);
436 virtual ThreadDataStruct GetThreadData(
int threadId);
475 void operator=(
const Self&);
489 template <
typename TInputImageType>
490 void DispatchedMinMax(
const TInputImageType* img);
492 template <
typename TInputImageType>
493 void DispatchedArrayMinMax(
const TInputImageType* img);
495 template <
typename TInputImageType>
496 void DispatchedVectorMinMax(
const TInputImageType* img);
498 template <
typename TInputImageType>
499 void DispatchedRiemannianMinMax(
const TInputImageType* img);
506 const int itkNotUsed(threadId),
510 virtual void ResolveRiemannianMinMax();
512 void ComputeSignedEuclideanDifferenceAndWeightedSquaredNorm(
const PixelType& a,
const PixelType& b,
514 bool useCachedComputations,
524 bool useCachedComputations,
530 template <
typename TensorValueT>
551 #ifndef ITK_MANUAL_INSTANTIATION
552 # include "itkPatchBasedDenoisingImageFilter.hxx"