RTK  1.4.0
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 "vnl/vnl_math.h"
30 #include "rtkConfiguration.h"
31 
32 namespace rtk
33 {
45 template< typename TInputImage,
46  typename TRealType = float,
47  typename TOutputImage = TInputImage>
48 class ITK_EXPORT SoftThresholdTVImageFilter:
49  public itk::ImageToImageFilter< TInputImage, TOutputImage >
50 {
51 public:
57 
59  itkNewMacro(Self);
60 
63 
66  typedef typename TOutputImage::PixelType OutputPixelType;
67  typedef typename TInputImage::PixelType InputPixelType;
68 
70  typedef TInputImage InputImageType;
71  typedef TOutputImage OutputImageType;
72  typedef typename InputImageType::Pointer InputImagePointer;
73  typedef typename OutputImageType::Pointer OutputImagePointer;
74 
76  itkStaticConstMacro(ImageDimension, unsigned int,
77  TOutputImage::ImageDimension);
78 
80  itkStaticConstMacro(VectorDimension, unsigned int,
81  InputPixelType::Dimension);
82 
84  typedef TRealType RealType;
87 
89  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
90 
91 #ifdef ITK_USE_CONCEPT_CHECKING
92 
93  itkConceptMacro( InputHasNumericTraitsCheck,
95  itkConceptMacro( RealTypeHasNumericTraitsCheck,
97 
99 #endif
100 
101  itkGetMacro(Threshold, float)
102  itkSetMacro(Threshold, float)
103 
104 protected:
106  virtual ~SoftThresholdTVImageFilter() ITK_OVERRIDE {}
107 
111 // void BeforeThreadedGenerateData();
112 
124 #if ITK_VERSION_MAJOR<5
125  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
126  ThreadIdType threadId) ITK_OVERRIDE;
127 #else
128  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) ITK_OVERRIDE;
129 #endif
130 
131 
132 // typedef typename InputImageType::Superclass ImageBaseType;
133 
134 private:
135  float m_Threshold;
137 
138  SoftThresholdTVImageFilter(const Self &); //purposely not implemented
139  void operator=(const Self &); //purposely not implemented
140 };
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "rtkSoftThresholdTVImageFilter.hxx"
145 #endif
146 
147 #endif
Superclass::OutputImageRegionType OutputImageRegionType
itk::Image< RealVectorType, TInputImage::ImageDimension > RealVectorImageType
itk::Vector< TRealType, InputPixelType::Dimension > RealVectorType
unsigned int ThreadIdType
itk::SmartPointer< const Self > ConstPointer
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Computes the Total Variation from a gradient input image (pixels are vectors), soft thresholds it...
#define itkConceptMacro(name, concept)
#define itkSetMacro(name, type)