RTK  1.4.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  * 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 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 
53 template< typename TImage, unsigned ModelOrder >
55 : public itk::InPlaceImageFilter < TImage, TImage >
56 {
57 public:
58 
64 
66  itkNewMacro(Self)
67 
68 
70 
71  typedef typename TImage::RegionType ImageRegionType;
72  typedef typename TImage::SizeType ImageSizeType;
73  typedef typename TImage::PixelType PixelType;
74  typedef typename TImage::IndexType IndexType;
75  typedef typename itk::Vector<float, ModelOrder> VectorType;
76  typedef typename std::vector<float> FloatVectorType;
77  typedef typename TImage::RegionType OutputImageRegionType;
78 
80  itkGetMacro(A, VectorType)
81  itkGetMacro(B, VectorType)
82  virtual void SetCoefficients(const VectorType A, const VectorType B)
83  {
84  if ((this->m_A != A) && (this->m_B != B))
85  {
86  if ((A.Size() == ModelOrder) && (B.Size() == ModelOrder)) {}
87  this->m_A = A;
88  this->m_B = B;
89  this->Modified();
91  }
92  }
94 
95 protected:
97  virtual ~LagCorrectionImageFilter() ITK_OVERRIDE {}
98 
99  void GenerateOutputInformation() ITK_OVERRIDE;
100 
101  void GenerateInputRequestedRegion() ITK_OVERRIDE;
102 
103  void ThreadedGenerateData(const ImageRegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE;
104 
108  unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType& splitRegion) ITK_OVERRIDE;
109  virtual int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
111 
112  VectorType m_A; // a_n coefficients (lag rates)
113  VectorType m_B; // b coefficients (lag coefficients)
114  VectorType m_ExpmA; // exp(-a)
115  float m_SumB; // normalization factor
116 
117 protected:
118  FloatVectorType m_S; // State variable
119 
120 private:
121  LagCorrectionImageFilter(const Self &); // purposely not implemented
122  void operator=(const Self &); // purposely not implemented
123 
124  bool m_NewParamJustReceived; // For state/correction initialization
125  IndexType m_StartIdx; // To account for cropping
126 };
127 
128 }
129 
130 #ifndef ITK_MANUAL_INSTANTIATION
131 #include "rtkLagCorrectionImageFilter.hxx"
132 #endif
133 
134 #endif
void ThreadedGenerateData(const ImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) override
itk::InPlaceImageFilter< TImage, TImage > Superclass
Classical Linear Time Invariant Lag correction.
void GenerateInputRequestedRegion() override
STL namespace.
itk::SmartPointer< const Self > ConstPointer
ImageBaseType::SizeType SizeType
void operator=(const Self &)
unsigned int ThreadIdType
virtual void SetCoefficients(const VectorType A, const VectorType B)
void GenerateOutputInformation() override
unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType &splitRegion) override
ImageBaseType::RegionType RegionType