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 #ifdef itkOverrideGetNameOfClassMacro
59  itkOverrideGetNameOfClassMacro(AddMatrixAndDiagonalImageFilter);
60 #else
62 #endif
63 
64 
66  static constexpr unsigned int nChannels = TDiagonal::PixelType::Dimension;
67 
69  using dataType = typename TDiagonal::PixelType::ValueType;
70 
72  void
73  SetInputDiagonal(const TDiagonal * gradient);
74  void
75  SetInputMatrix(const TMatrix * hessian);
77 
78 protected:
80  ~AddMatrixAndDiagonalImageFilter() override = default;
81 
82  void
83  GenerateInputRequestedRegion() override;
84 
86  void
87  DynamicThreadedGenerateData(const typename TDiagonal::RegionType & outputRegionForThread) override;
88 
90  typename TDiagonal::ConstPointer
91  GetInputDiagonal();
92  typename TMatrix::ConstPointer
93  GetInputMatrix();
94 };
95 } // namespace rtk
97 
98 
99 #ifndef ITK_MANUAL_INSTANTIATION
100 # include "rtkAddMatrixAndDiagonalImageFilter.hxx"
101 #endif
102 
103 #endif
typename TDiagonal::PixelType::ValueType dataType
For each vector-valued pixel, adds a vector to the diagonal of a matrix.