RTK  1.4.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 
56  typedef typename OutputImageType::Pointer OutputImagePointer;
57 
59  itkNewMacro(Self)
60 
61 
63 
65  itkGetMacro(NumberOfIterations, int)
66  itkSetMacro(NumberOfIterations, int)
67 
69  itkGetMacro(IterationCosts, bool)
70  itkSetMacro(IterationCosts, bool)
71 
72  void SetA(ConjugateGradientOperatorPointerType _arg );
73 
75  void SetX(const OutputImageType* OutputImage);
76 
78  void SetB(const OutputImageType* OutputImage);
79 
81  void SetC(const double _arg);
82  double GetC();
84 
86  const std::vector<double> &GetResidualCosts();
87 
88 protected:
89  ConjugateGradientImageFilter();
90  virtual ~ConjugateGradientImageFilter() ITK_OVERRIDE {}
91 
92  OutputImagePointer GetX();
93  OutputImagePointer GetB();
94 
96  void GenerateData() ITK_OVERRIDE;
97 
99  void GenerateInputRequestedRegion() ITK_OVERRIDE;
100  void GenerateOutputInformation() ITK_OVERRIDE;
102 
103  ConjugateGradientOperatorPointerType m_A;
104 
107  std::vector<double> m_ResidualCosts;
108  double m_C;
109 
110 private:
111  ConjugateGradientImageFilter(const Self &); //purposely not implemented
112  void operator=(const Self &); //purposely not implemented
113 };
114 } //namespace RTK
115 
116 
117 #ifndef ITK_MANUAL_INSTANTIATION
118 #include "rtkConjugateGradientImageFilter.hxx"
119 #endif
120 
121 #endif
void SetC(const double _arg)
void SetA(ConjugateGradientOperatorPointerType _arg)
void GenerateOutputInformation() override
STL namespace.
ConjugateGradientOperator< OutputImageType > ConjugateGradientOperatorType
void GenerateInputRequestedRegion() override
void SetB(const OutputImageType *OutputImage)
itk::InPlaceImageFilter< OutputImageType, OutputImageType > Superclass
void SetX(const OutputImageType *OutputImage)
ConjugateGradientOperatorPointerType m_A
const std::vector< double > & GetResidualCosts()
ConjugateGradientOperatorType::Pointer ConjugateGradientOperatorPointerType
Solves AX = B by conjugate gradient.
#define itkSetMacro(name, type)