RTK  2.5.0
Reconstruction Toolkit
rtkMotionCompensatedFourDConjugateGradientConeBeamReconstructionFilter.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 
19 #ifndef rtkMotionCompensatedFourDConjugateGradientConeBeamReconstructionFilter_h
20 #define rtkMotionCompensatedFourDConjugateGradientConeBeamReconstructionFilter_h
21 
25 #ifdef RTK_USE_CUDA
28 #endif
29 
30 namespace rtk
31 {
69 template <typename VolumeSeriesType, typename ProjectionStackType>
71  : public rtk::FourDConjugateGradientConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>
72 {
73 public:
75 
81 
83  using InputImageType = VolumeSeriesType;
84  using OutputImageType = VolumeSeriesType;
85  using VolumeType = ProjectionStackType;
86  using VectorForDVF = itk::CovariantVector<typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1>;
87 
88  using ForwardProjectionType = typename Superclass::ForwardProjectionType;
89  using BackProjectionType = typename Superclass::BackProjectionType;
90 
92  using CPUVolumeSeriesType =
94 #ifdef RTK_USE_CUDA
95  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
97  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension>>::type
99  typedef
100  typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
101  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
102  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1>>::type DVFImageType;
103 #else
105  using DVFImageType = itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
106 #endif
107 
111  itkNewMacro(Self);
112 
114 #ifdef itkOverrideGetNameOfClassMacro
116 #else
119 #endif
120 
121 
123  void
125  {
126  itkExceptionMacro(<< "ForwardProjection cannot be changed");
127  }
128  void
129  SetBackProjectionFilter(BackProjectionType itkNotUsed(_arg)) override
130  {
131  itkExceptionMacro(<< "BackProjection cannot be changed");
132  }
134 
136  void
137  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
138  void
139  SetInverseDisplacementField(const DVFSequenceImageType * InverseDisplacementField);
140  typename DVFSequenceImageType::ConstPointer
141  GetDisplacementField();
142  typename DVFSequenceImageType::ConstPointer
143  GetInverseDisplacementField();
145 
147  void
148  SetSignal(const std::vector<double> signal) override;
149 
150  // Sub filters type alias
152  using MCCGOperatorType =
154 
156  itkSetMacro(UseCudaCyclicDeformation, bool);
157  itkGetMacro(UseCudaCyclicDeformation, bool);
159 
160 protected:
163 
164  void
165  GenerateOutputInformation() override;
166  void
167  GenerateInputRequestedRegion() override;
168 
170 
171 }; // end of class
172 
173 } // end namespace rtk
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 # include "rtkMotionCompensatedFourDConjugateGradientConeBeamReconstructionFilter.hxx"
177 #endif
178 
179 #endif
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
#define itkSetMacro(name, type)
TOutputImage OutputImageType
Back projection part for motion compensated iterative 4D reconstruction.
Implements part of the 4D reconstruction by conjugate gradient.