RTK  2.6.0
Reconstruction Toolkit
rtkAddMatrixAndDiagonalImageFilter.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 #ifndef rtkAddMatrixAndDiagonalImageFilter_h
19 #define rtkAddMatrixAndDiagonalImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "rtkMacro.h"
23 
24 namespace rtk
25 {
40 template <class TDiagonal,
41  class TMatrix = itk::Image<itk::Vector<typename TDiagonal::PixelType::ValueType,
42  TDiagonal::PixelType::Dimension * TDiagonal::PixelType::Dimension>,
43  TDiagonal::ImageDimension>>
44 class ITK_TEMPLATE_EXPORT AddMatrixAndDiagonalImageFilter : public itk::ImageToImageFilter<TMatrix, TMatrix>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(AddMatrixAndDiagonalImageFilter);
48 
53 
55  itkNewMacro(Self);
56 
58  itkOverrideGetNameOfClassMacro(AddMatrixAndDiagonalImageFilter);
59 
61  static constexpr unsigned int nChannels = TDiagonal::PixelType::Dimension;
62 
64  using dataType = typename TDiagonal::PixelType::ValueType;
65 
67  void
68  SetInputDiagonal(const TDiagonal * gradient);
69  void
70  SetInputMatrix(const TMatrix * hessian);
72 
73 protected:
75  ~AddMatrixAndDiagonalImageFilter() override = default;
76 
77  void
78  GenerateInputRequestedRegion() override;
79 
81  void
82  DynamicThreadedGenerateData(const typename TDiagonal::RegionType & outputRegionForThread) override;
83 
85  typename TDiagonal::ConstPointer
86  GetInputDiagonal();
87  typename TMatrix::ConstPointer
88  GetInputMatrix();
89 };
90 } // namespace rtk
92 
93 
94 #ifndef ITK_MANUAL_INSTANTIATION
95 # include "rtkAddMatrixAndDiagonalImageFilter.hxx"
96 #endif
97 
98 #endif
typename TDiagonal::PixelType::ValueType dataType
For each vector-valued pixel, adds a vector to the diagonal of a matrix.