RTK  2.1.0
Reconstruction Toolkit
rtkConjugateGradientImageFilter.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 rtkConjugateGradientImageFilter_h
20 #define rtkConjugateGradientImageFilter_h
21 
22 #include <itkSubtractImageFilter.h>
24 #include <itkTimeProbe.h>
25 
27 
32 
33 namespace rtk
34 {
35 
45 template <typename OutputImageType>
46 class ConjugateGradientImageFilter : public itk::InPlaceImageFilter<OutputImageType, OutputImageType>
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(ConjugateGradientImageFilter);
50 
57  using OutputImagePointer = typename OutputImageType::Pointer;
58 
60  itkNewMacro(Self);
61 
64 
66  itkGetMacro(NumberOfIterations, int);
67  itkSetMacro(NumberOfIterations, int);
69 
71  itkGetMacro(IterationCosts, bool);
72  itkSetMacro(IterationCosts, bool);
74 
75  void
77 
79  void
80  SetX(const OutputImageType * OutputImage);
81 
83  void
84  SetB(const OutputImageType * OutputImage);
85 
87  void
88  SetC(const double _arg);
89  double
90  GetC();
92 
94  const std::vector<double> &
96 
97 protected:
99  ~ConjugateGradientImageFilter() override = default;
100 
102  GetX();
104  GetB();
105 
107  void
108  GenerateData() override;
109 
111  void
112  GenerateInputRequestedRegion() override;
113  void
114  GenerateOutputInformation() override;
116 
118 
121  std::vector<double> m_ResidualCosts;
122  double m_C;
123 };
124 } // namespace rtk
125 
126 
127 #ifndef ITK_MANUAL_INSTANTIATION
128 # include "rtkConjugateGradientImageFilter.hxx"
129 #endif
130 
131 #endif
typename OutputImageType::Pointer OutputImagePointer
void SetC(const double _arg)
void SetA(ConjugateGradientOperatorPointerType _arg)
void GenerateOutputInformation() override
#define itkSetMacro(name, type)
typename ConjugateGradientOperatorType::Pointer ConjugateGradientOperatorPointerType
void GenerateInputRequestedRegion() override
TOutputImage OutputImageType
void SetB(const OutputImageType *OutputImage)
void SetX(const OutputImageType *OutputImage)
ConjugateGradientOperatorPointerType m_A
const std::vector< double > & GetResidualCosts()
~ConjugateGradientImageFilter() override=default
Solves AX = B by conjugate gradient.