Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
Medical Imaging Interaction Toolkit
itkTotalVariationSingleIterationImageFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef __itkTotalVariationSingleIterationImageFilter_h
14 #define __itkTotalVariationSingleIterationImageFilter_h
15 
16 #include "itkImage.h"
17 #include "itkImageToImageFilter.h"
18 
19 namespace itk
20 {
33  template <class TInputImage, class TOutputImage>
34  class TotalVariationSingleIterationImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
35  {
36  public:
38  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
39  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
40 
42  typedef TInputImage InputImageType;
43  typedef TOutputImage OutputImageType;
44 
45  typedef itk::Image<float, InputImageDimension> LocalVariationImageType;
46 
49  typedef ImageToImageFilter<InputImageType, OutputImageType> Superclass;
52 
54  itkFactorylessNewMacro(Self);
55  itkCloneMacro(Self);
56 
58  itkTypeMacro(TotalVariationSingleIterationImageFilter, ImageToImageFilter);
59 
61  typedef typename InputImageType::PixelType InputPixelType;
62  typedef typename OutputImageType::PixelType OutputPixelType;
63 
64  typedef typename InputImageType::RegionType InputImageRegionType;
65  typedef typename OutputImageType::RegionType OutputImageRegionType;
66 
67  typedef typename InputImageType::SizeType InputSizeType;
68 
75  void GenerateInputRequestedRegion() override;
76 
77  itkSetMacro(Lambda, double);
78  itkGetMacro(Lambda, double);
79 
80  void SetOriginalImage(InputImageType *in) { this->m_OriginalImage = in; }
81  typename InputImageType::Pointer GetOriginialImage() { return this->m_OriginalImage; }
82  protected:
85  void PrintSelf(std::ostream &os, Indent indent) const override;
86 
97  void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override;
98 
99  void BeforeThreadedGenerateData() override;
100 
101  typename LocalVariationImageType::Pointer m_LocalVariation;
102 
103  typename InputImageType::Pointer m_OriginalImage;
104 
105  double m_Lambda;
106 
107  private:
109 
110  void operator=(const Self &);
111  };
112 
113 } // end namespace itk
114 
115 #ifndef ITK_MANUAL_INSTANTIATION
117 #endif
118 
119 #endif //__itkTotalVariationSingleIterationImageFilter__
ImageToImageFilter< InputImageType, OutputImageType > Superclass
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
Applies a total variation denoising filter to an image.
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
void PrintSelf(std::ostream &os, Indent indent) const override
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244