RTK  1.4.0
Reconstruction Toolkit
rtkPolynomialGainCorrectionImageFilter.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 rtkPolynomialGainCorrectionImageFilter_h
20 #define rtkPolynomialGainCorrectionImageFilter_h
21 
22 #include <itkImageToImageFilter.h>
23 
24 #include <vector>
25 
26 #include "rtkMacro.h"
27 
40 namespace rtk
41 {
42 
43 template<class TInputImage, class TOutputImage>
45 public itk::ImageToImageFilter<TInputImage, TOutputImage>
46 {
47 public:
53 
55  typedef TInputImage InputImageType;
56  typedef TOutputImage OutputImageType;
57  typedef typename InputImageType::Pointer InputImagePointer;
58  typedef typename OutputImageType::Pointer OutputImagePointer;
59  typedef typename InputImageType::RegionType InputImageRegionType;
60  typedef typename TOutputImage::RegionType OutputImageRegionType;
61  typedef typename std::vector< float > VectorType;
62  typedef typename OutputImageType::SizeType OutputSizeType;
63 
65  itkNewMacro(Self);
66 
69 
71  void SetDarkImage(const InputImagePointer gain);
72 
75  void SetGainCoefficients(const OutputImagePointer gain);
76 
77  /* if K==0, the filter is bypassed */
78  itkSetMacro(K, float);
79  itkGetMacro(K, float);
80 
81 protected:
83  virtual ~PolynomialGainCorrectionImageFilter() ITK_OVERRIDE {}
84 
85  void GenerateOutputInformation() ITK_OVERRIDE;
86 
87  void GenerateInputRequestedRegion() ITK_OVERRIDE;
88 
89 #if ITK_VERSION_MAJOR<5
90  void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE;
91 #else
92  void DynamicThreadedGenerateData( const OutputImageRegionType& outputRegionForThread) ITK_OVERRIDE;
93 #endif
94 
95 private:
96  //purposely not implemented
98  void operator=(const Self&);
99 
100 protected:
101  bool m_MapsLoaded; // True if gain maps loaded
102  int m_ModelOrder; // Polynomial correction order
103  float m_K; // Scaling constant, a 0 means no correction
104  VectorType m_PowerLut; // Vector containing I^n
105  InputImagePointer m_DarkImage; // Dark image
106  OutputImagePointer m_GainImage; // Gain coefficients (A matrix)
107  OutputSizeType m_GainSize; // Gain map size
108 }; // end of class
109 
110 }
111 
112 #ifndef ITK_MANUAL_INSTANTIATION
113 #include "rtkPolynomialGainCorrectionImageFilter.hxx"
114 #endif
115 
116 #endif
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) override
void SetDarkImage(const InputImagePointer gain)
unsigned int ThreadIdType
void SetGainCoefficients(const OutputImagePointer gain)
#define itkSetMacro(name, type)