RTK  2.0.1
Reconstruction Toolkit
rtkTotalVariationDenoiseSequenceImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
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  * http://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 
19 #ifndef rtkTotalVariationDenoiseSequenceImageFilter_h
20 #define rtkTotalVariationDenoiseSequenceImageFilter_h
21 
22 #include "rtkConstantImageSource.h"
23 
24 #include <itkExtractImageFilter.h>
25 #include <itkPasteImageFilter.h>
26 #include <itkCastImageFilter.h>
27 
28 #ifdef RTK_USE_CUDA
30 #else
32 #endif
33 
34 namespace rtk
35 {
77 template< typename TImageSequence >
78 class TotalVariationDenoiseSequenceImageFilter : public itk::ImageToImageFilter<TImageSequence, TImageSequence>
79 {
80 public:
81  ITK_DISALLOW_COPY_AND_ASSIGN(TotalVariationDenoiseSequenceImageFilter);
82 
87 
89  itkNewMacro(Self)
90 
91 
93 
95  itkGetMacro(Gamma, double)
96  itkSetMacro(Gamma, double)
97 
98  itkGetMacro(NumberOfIterations, int)
99  itkSetMacro(NumberOfIterations, int)
100 
101  void SetDimensionsProcessed(bool* arg);
102 
104 #ifdef RTK_USE_CUDA
105  using TImage = itk::CudaImage<typename TImageSequence::PixelType, TImageSequence::ImageDimension - 1>;
106  using TVDenoisingFilterType = rtk::CudaTotalVariationDenoisingBPDQImageFilter;
107 #else
108  using TImage = itk::Image<typename TImageSequence::PixelType, TImageSequence::ImageDimension - 1>;
110 #endif
115 
116 protected:
118  ~TotalVariationDenoiseSequenceImageFilter() override = default;
119 
121  void GenerateData() override;
122 
123  void GenerateOutputInformation() override;
124  void GenerateInputRequestedRegion() override;
125 
128  typename ExtractFilterType::Pointer m_ExtractFilter;
132 
134  typename TImageSequence::RegionType m_ExtractAndPasteRegion;
135 
137  double m_Gamma{1.};
139  bool m_DimensionsProcessed[TImage::ImageDimension];
140 };
141 } //namespace ITK
142 
143 
144 #ifndef ITK_MANUAL_INSTANTIATION
145 #include "rtkTotalVariationDenoiseSequenceImageFilter.hxx"
146 #endif
147 
148 #endif
Generate an n-dimensional image with constant pixel values.
Applies 3D total variation denoising to a 3D + time sequence of images.
Applies a total variation denoising, only alm_SingularValueThresholdFilterong the dimensions specifie...
~TotalVariationDenoiseSequenceImageFilter() override=default
#define itkSetMacro(name, type)