RTK  2.6.0
Reconstruction Toolkit
rtkLagCorrectionImageFilter.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  * https://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 rtkLagCorrectionImageFilter_h
20 #define rtkLagCorrectionImageFilter_h
21 
22 #include <itkInPlaceImageFilter.h>
23 #include <itkVector.h>
24 #include <vector>
25 
26 #include "rtkConfiguration.h"
27 #include "rtkMacro.h"
28 
29 namespace rtk
30 {
31 
54 template <typename TImage, unsigned VModelOrder>
55 class ITK_TEMPLATE_EXPORT LagCorrectionImageFilter : public itk::InPlaceImageFilter<TImage, TImage>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(LagCorrectionImageFilter);
59 
65 
67  itkNewMacro(Self);
68 
70  itkOverrideGetNameOfClassMacro(LagCorrectionImageFilter);
71 
72  using ImageRegionType = typename TImage::RegionType;
73  using ImageSizeType = typename TImage::SizeType;
74  using PixelType = typename TImage::PixelType;
75  using IndexType = typename TImage::IndexType;
77  using FloatVectorType = typename std::vector<float>;
78  using OutputImageRegionType = typename TImage::RegionType;
79 
81  itkGetMacro(A, VectorType);
82  itkGetMacro(B, VectorType);
83  virtual void
85  {
86  if ((this->m_A != A) && (this->m_B != B))
87  {
88  if ((A.Size() == VModelOrder) && (B.Size() == VModelOrder))
89  {
90  }
91  this->m_A = A;
92  this->m_B = B;
93  this->Modified();
94  m_NewParamJustReceived = true;
95  }
96  }
98 
99 protected:
101  ~LagCorrectionImageFilter() override = default;
102 
103  void
104  GenerateOutputInformation() override;
105 
106  void
107  GenerateInputRequestedRegion() override;
108 
109  void
110  ThreadedGenerateData(const ImageRegionType & thRegion, itk::ThreadIdType threadId) override;
111 
115  unsigned int
116  SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion) override;
117  virtual int
118  SplitRequestedRegion(int i, int num, OutputImageRegionType & splitRegion);
120 
121  VectorType m_A; // a_n coefficients (lag rates)
122  VectorType m_B; // b coefficients (lag coefficients)
123  VectorType m_ExpmA; // exp(-a)
124  float m_SumB; // normalization factor
125 
126 protected:
127  FloatVectorType m_S; // State variable
128 
129 private:
130  bool m_NewParamJustReceived; // For state/correction initialization
131  IndexType m_StartIdx; // To account for cropping
132 };
133 
134 } // namespace rtk
135 
136 #ifndef ITK_MANUAL_INSTANTIATION
137 # include "rtkLagCorrectionImageFilter.hxx"
138 #endif
139 
140 #endif
typename TImage::PixelType PixelType
virtual void SetCoefficients(const VectorType A, const VectorType B)
Classical Linear Time Invariant Lag correction.
typename itk::Vector< float, VModelOrder > VectorType
typename std::vector< float > FloatVectorType
typename OutputImageType::RegionType OutputImageRegionType
typename TImage::SizeType ImageSizeType
typename TImage::RegionType ImageRegionType
unsigned int ThreadIdType
typename TImage::IndexType IndexType