ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkPatchBasedDenoisingBaseImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkPatchBasedDenoisingBaseImageFilter_h
19#define itkPatchBasedDenoisingBaseImageFilter_h
20
22#include "itkArray.h"
23#include "itkSample.h"
24#include "itkNumericTraits.h"
28#include "itkRGBPixel.h"
29#include "itkRGBAPixel.h"
31#include "ITKDenoisingExport.h"
32
33namespace itk
34{
40{
41public:
46 enum class NoiseModel : uint8_t
47 {
50 RICIAN = 2,
52 };
53
60 enum class ComponentSpace : uint8_t
61 {
64 };
65
70 enum class FilterState : uint8_t
71 {
74 };
75};
76// Define how to print enumeration
77extern ITKDenoising_EXPORT std::ostream &
79extern ITKDenoising_EXPORT std::ostream &
81// Define how to print enumeration
82extern ITKDenoising_EXPORT std::ostream &
128
129template <typename TInputImage, typename TOutputImage>
130class ITK_TEMPLATE_EXPORT PatchBasedDenoisingBaseImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
131{
132public:
133 ITK_DISALLOW_COPY_AND_MOVE(PatchBasedDenoisingBaseImageFilter);
134
140
142 itkOverrideGetNameOfClassMacro(PatchBasedDenoisingBaseImageFilter);
143
145 using InputImageType = TInputImage;
146 using OutputImageType = TOutputImage;
147
149 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
150
154 using InputPixelType = typename InputImageType::PixelType;
155 using OutputPixelType = typename OutputImageType::PixelType;
158
162#if !defined(ITK_LEGACY_REMOVE)
167 static constexpr NoiseModelEnum NOMODEL = NoiseModelEnum::NOMODEL;
168 static constexpr NoiseModelEnum GAUSSIAN = NoiseModelEnum::GAUSSIAN;
169 static constexpr NoiseModelEnum RICIAN = NoiseModelEnum::RICIAN;
170 static constexpr NoiseModelEnum POISSON = NoiseModelEnum::POISSON;
171
172 static constexpr ComponentSpaceEnum EUCLIDEAN = ComponentSpaceEnum::EUCLIDEAN;
173 static constexpr ComponentSpaceEnum RIEMANNIAN = ComponentSpaceEnum::RIEMANNIAN;
174
175 static constexpr FilterStateEnum UNINITIALIZED = FilterStateEnum::UNINITIALIZED;
176 static constexpr FilterStateEnum INITIALIZED = FilterStateEnum::INITIALIZED;
177#endif
178
183
190 using PatchRadiusType = typename ListAdaptorType::NeighborhoodRadiusType;
192
198 itkSetMacro(PatchRadius, unsigned int);
199 itkGetConstMacro(PatchRadius, unsigned int);
201
204
207
208 typename PatchRadiusType::SizeValueType
210
215 void
217
220
225 itkSetEnumMacro(NoiseModel, NoiseModelEnum);
226 itkGetConstMacro(NoiseModel, NoiseModelEnum);
228
234 itkSetClampMacro(SmoothingWeight, double, 0.0, 1.0);
235 itkGetConstMacro(SmoothingWeight, double);
237
243 itkSetClampMacro(NoiseModelFidelityWeight, double, 0.0, 1.0);
244 itkGetConstMacro(NoiseModelFidelityWeight, double);
246
251 itkSetMacro(KernelBandwidthEstimation, bool);
252 itkBooleanMacro(KernelBandwidthEstimation);
253 itkGetConstMacro(KernelBandwidthEstimation, bool);
255
262 itkSetClampMacro(KernelBandwidthUpdateFrequency, unsigned int, 1, NumericTraits<unsigned int>::max());
263 itkGetConstMacro(KernelBandwidthUpdateFrequency, unsigned int);
265
270 itkSetClampMacro(NumberOfIterations, unsigned int, 1, NumericTraits<unsigned int>::max());
271 itkGetConstReferenceMacro(NumberOfIterations, unsigned int);
273
275 itkGetConstReferenceMacro(ElapsedIterations, unsigned int);
276
281 itkSetMacro(AlwaysTreatComponentsAsEuclidean, bool);
282 itkBooleanMacro(AlwaysTreatComponentsAsEuclidean);
283 itkGetConstMacro(AlwaysTreatComponentsAsEuclidean, bool);
285
287 virtual void
289
291 virtual void
293
295#if !defined(ITK_WRAPPING_PARSER)
296 itkSetEnumMacro(State, FilterStateEnum);
297 itkGetConstReferenceMacro(State, FilterStateEnum);
298#endif
300
305 itkSetMacro(ManualReinitialization, bool);
306 itkGetConstReferenceMacro(ManualReinitialization, bool);
307 itkBooleanMacro(ManualReinitialization);
309
310protected:
313
314 void
315 PrintSelf(std::ostream & os, Indent indent) const override;
316
317 void
319
320 void
321 GenerateData() override;
322
323 virtual void
325
327 virtual void
329
330 virtual void
332 {}
333
335 virtual void
337
338 virtual void
341
342 virtual void
345
347 virtual void
349
351 virtual void
353
354 virtual void
356
357 virtual void
360
362 virtual bool
364
365 virtual bool
366 ThreadedHalt(void * itkNotUsed(threadInfo))
367 {
368 return this->Halt();
369 }
370
371 itkSetMacro(ElapsedIterations, unsigned int);
372
376 {
377 return ComponentSpaceEnum::EUCLIDEAN;
378 }
379
380 ComponentSpaceEnum
382 {
383 return ComponentSpaceEnum::EUCLIDEAN;
384 }
385
386 ComponentSpaceEnum
388 {
389 return ComponentSpaceEnum::RIEMANNIAN;
390 }
391
392 template <typename PixelT>
393 ComponentSpaceEnum
394 DetermineComponentSpace(const PixelT & itkNotUsed(p))
395 {
396 return ComponentSpaceEnum::EUCLIDEAN;
397 }
398
400 itkSetEnumMacro(ComponentSpace, ComponentSpaceEnum);
401 itkGetConstMacro(ComponentSpace, ComponentSpaceEnum);
403
404 // Cache input and output pointer to get rid of thousands of calls
405 // to GetInput and GetOutput.
408
409private:
411 unsigned int m_PatchRadius{ 4 };
413
417
420 unsigned int m_NumberOfIterations{ 1 };
421 unsigned int m_ElapsedIterations{ 0 };
422
424 NoiseModelEnum m_NoiseModel{ NoiseModelEnum::NOMODEL };
425 double m_SmoothingWeight{ 1.0 };
427
431 ComponentSpaceEnum m_ComponentSpace{ ComponentSpaceEnum::EUCLIDEAN };
432
434
435 FilterStateEnum m_State{ FilterStateEnum::UNINITIALIZED };
436};
437} // end namespace itk
438
439#ifndef ITK_MANUAL_INSTANTIATION
440# include "itkPatchBasedDenoisingBaseImageFilter.hxx"
441#endif
442
443#endif
Array class with size defined at construction time.
Definition itkArray.h:48
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Represent a diffusion tensor as used in DTI images.
Control indentation during Print() invocation.
Definition itkIndent.h:50
static constexpr T max(const T &)
Contains all enum classes used by the PatchBasedDenoisingBaseImageFilter class.
ComponentSpaceEnum DetermineComponentSpace(const RGBPixel< PixelValueType > &p)
typename NumericTraits< PixelType >::ValueType PixelValueType
typename itk::Statistics::ImageToNeighborhoodSampleAdaptor< OutputImageType, BoundaryConditionType > ListAdaptorType
void PrintSelf(std::ostream &os, Indent indent) const override
PatchWeightsType GetPatchWeights() const
typename ListAdaptorType::NeighborhoodRadiusType PatchRadiusType
~PatchBasedDenoisingBaseImageFilter() override=default
PatchRadiusType GetPatchDiameterInVoxels() const
ComponentSpaceEnum DetermineComponentSpace(const DiffusionTensor3D< PixelValueType > &p)
PatchRadiusType::SizeValueType GetPatchLengthInVoxels() const
PatchBasedDenoisingBaseImageFilterEnums::ComponentSpace ComponentSpaceEnum
void SetPatchWeights(const PatchWeightsType &weights)
ImageToImageFilter< TInputImage, TOutputImage > Superclass
ConstNeighborhoodIterator< InputImageType, BoundaryConditionType > InputImagePatchIterator
ZeroFluxNeumannBoundaryCondition< OutputImageType > BoundaryConditionType
ComponentSpaceEnum DetermineComponentSpace(const RGBAPixel< PixelValueType > &p)
PatchBasedDenoisingBaseImageFilterEnums::NoiseModel NoiseModelEnum
PatchRadiusType GetPatchRadiusInVoxels() const
PatchBasedDenoisingBaseImageFilterEnums::FilterState FilterStateEnum
Represent Red, Green, Blue and Alpha components for color images.
Represent Red, Green and Blue components for color images.
Definition itkRGBPixel.h:59
Implements transparent reference counting.
This class provides ListSample interface to ITK Image.
A function object that determines a neighborhood of values at an image boundary according to a Neuman...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)