RTK  2.0.1
Reconstruction Toolkit
rtkSoftThresholdTVImageFilter.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 rtkSoftThresholdTVImageFilter_h
20 #define rtkSoftThresholdTVImageFilter_h
21 
23 #include <itkImageToImageFilter.h>
24 #include <itkImage.h>
25 #include <itkVector.h>
26 #include "vnl/vnl_matrix.h"
27 #include "vnl/vnl_vector_fixed.h"
28 #include "vnl/algo/vnl_symmetric_eigensystem.h"
29 #include "rtkConfiguration.h"
30 
31 namespace rtk
32 {
44 template< typename TInputImage,
45  typename TRealType = float,
46  typename TOutputImage = TInputImage>
47 class ITK_EXPORT SoftThresholdTVImageFilter:
48  public itk::ImageToImageFilter< TInputImage, TOutputImage >
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(SoftThresholdTVImageFilter);
52 
58 
60  itkNewMacro(Self);
61 
64 
67  using OutputPixelType = typename TOutputImage::PixelType;
68  using InputPixelType = typename TInputImage::PixelType;
69 
71  using InputImageType = TInputImage;
72  using OutputImageType = TOutputImage;
73  using InputImagePointer = typename InputImageType::Pointer;
74  using OutputImagePointer = typename OutputImageType::Pointer;
75 
77  itkStaticConstMacro(ImageDimension, unsigned int,
78  TOutputImage::ImageDimension);
79 
81  itkStaticConstMacro(VectorDimension, unsigned int,
82  InputPixelType::Dimension);
83 
85  using RealType = TRealType;
88 
90  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
91 
92 #ifdef ITK_USE_CONCEPT_CHECKING
93 
94  itkConceptMacro( InputHasNumericTraitsCheck,
96  itkConceptMacro( RealTypeHasNumericTraitsCheck,
98 
100 #endif
101 
102  itkGetMacro(Threshold, float)
103  itkSetMacro(Threshold, float)
104 
105 protected:
107  ~SoftThresholdTVImageFilter() override = default;
108 
112 // void BeforeThreadedGenerateData();
113 
125 #if ITK_VERSION_MAJOR<5
126  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
127  ThreadIdType threadId) override;
128 #else
129  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
130 #endif
131 
132 
133 // using ImageBaseType = typename InputImageType::Superclass;
134 
135 private:
136  float m_Threshold;
138 };
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "rtkSoftThresholdTVImageFilter.hxx"
143 #endif
144 
145 #endif
typename InputImageType::Pointer InputImagePointer
typename TOutputImage::PixelType OutputPixelType
typename TInputImage::PixelType InputPixelType
typename OutputImageType::Pointer OutputImagePointer
unsigned int ThreadIdType
Computes the Total Variation from a gradient input image (pixels are vectors), soft thresholds it...
typename Superclass::OutputImageRegionType OutputImageRegionType
#define itkConceptMacro(name, concept)
#define itkSetMacro(name, type)