RTK  1.4.0
Reconstruction Toolkit
rtkConjugateGradientGetR_kPlusOneImageFilter.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 rtkConjugateGradientGetR_kPlusOneImageFilter_h
20 #define rtkConjugateGradientGetR_kPlusOneImageFilter_h
21 
22 #include <itkImageToImageFilter.h>
23 #include <itkVectorImage.h>
24 #include <itkBarrier.h>
25 
26 #include "rtkConfiguration.h"
27 #include "rtkMacro.h"
28 
29 namespace rtk
30 {
37 template< typename TInputImage>
38 class ConjugateGradientGetR_kPlusOneImageFilter : public itk::ImageToImageFilter< TInputImage, TInputImage>
39 {
40 public:
45  typedef typename TInputImage::RegionType OutputImageRegionType;
46 
48  itkNewMacro(Self)
49 
50 
52 
54  void SetRk(const TInputImage* Rk);
55  void SetPk(const TInputImage* Pk);
56  void SetAPk(const TInputImage* APk);
58 
59  itkGetMacro(Alphak, double)
60  itkGetMacro(SquaredNormR_k, double)
61  itkGetMacro(SquaredNormR_kPlusOne, double)
62 
63 protected:
64  ConjugateGradientGetR_kPlusOneImageFilter();
65  virtual ~ConjugateGradientGetR_kPlusOneImageFilter() ITK_OVERRIDE {}
66 
67  typename TInputImage::Pointer GetRk();
68  typename TInputImage::Pointer GetPk();
69  typename TInputImage::Pointer GetAPk();
70 
74  void BeforeThreadedGenerateData() ITK_OVERRIDE;
75 
77  void ThreadedGenerateData(const typename TInputImage::RegionType &
78  outputRegionForThread,
79  ThreadIdType threadId) ITK_OVERRIDE;
80 
82  void AfterThreadedGenerateData() ITK_OVERRIDE;
83 
84 private:
85  ConjugateGradientGetR_kPlusOneImageFilter(const Self &); //purposely not implemented
86  void operator=(const Self &); //purposely not implemented
87  double m_Alphak;
90 
91  // Thread synchronization tool
93 
94  // These vector store one accumulation value per thread
95  // The values are then sumed
96  std::vector<double> m_SquaredNormR_kVector;
97  std::vector<double> m_SquaredNormR_kPlusOneVector;
98  std::vector<double> m_PktApkVector;
99 
100 };
101 
102 template<>
103 void
106  outputRegionForThread,
107  ThreadIdType threadId);
108 
109 } //namespace RTK
110 
111 
112 #ifndef ITK_MANUAL_INSTANTIATION
113 #include "rtkConjugateGradientGetR_kPlusOneImageFilter.hxx"
114 #endif
115 
116 #endif
itk::ImageToImageFilter< TInputImage, TInputImage > Superclass
unsigned int ThreadIdType
void ThreadedGenerateData(const typename TInputImage::RegionType &outputRegionForThread, ThreadIdType threadId) override
typename Superclass::RegionType RegionType