Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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) itkCloneMacro(Self)
55 
56 
57  itkTypeMacro(TotalVariationSingleIterationImageFilter, ImageToImageFilter);
58 
60  typedef typename InputImageType::PixelType InputPixelType;
61  typedef typename OutputImageType::PixelType OutputPixelType;
62 
63  typedef typename InputImageType::RegionType InputImageRegionType;
64  typedef typename OutputImageType::RegionType OutputImageRegionType;
65 
66  typedef typename InputImageType::SizeType InputSizeType;
67 
74  void GenerateInputRequestedRegion() override;
75 
76  itkSetMacro(Lambda, double);
77  itkGetMacro(Lambda, double);
78 
79  void SetOriginalImage(InputImageType *in) { this->m_OriginalImage = in; }
80  typename InputImageType::Pointer GetOriginialImage() { return this->m_OriginalImage; }
81  protected:
84  void PrintSelf(std::ostream &os, Indent indent) const override;
85 
96  void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override;
97 
98  void BeforeThreadedGenerateData() override;
99 
100  typename LocalVariationImageType::Pointer m_LocalVariation;
101 
102  typename InputImageType::Pointer m_OriginalImage;
103 
104  double m_Lambda;
105 
106  private:
108 
109  void operator=(const Self &);
110  };
111 
112 } // end namespace itk
113 
114 #ifndef ITK_MANUAL_INSTANTIATION
116 #endif
117 
118 #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
unsigned short PixelType