RTK  2.0.1
Reconstruction Toolkit
rtkMotionCompensatedFourDReconstructionConjugateGradientOperator.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 #ifndef rtkMotionCompensatedFourDReconstructionConjugateGradientOperator_h
19 #define rtkMotionCompensatedFourDReconstructionConjugateGradientOperator_h
20 
24 
25 #ifdef RTK_USE_CUDA
29 #endif
30 
31 namespace rtk
32 {
95 template< typename VolumeSeriesType, typename ProjectionStackType>
97 {
98 public:
100 
105 
107  using VolumeType = ProjectionStackType;
108  using VectorForDVF = itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1>;
109 
111  using CPUVolumeSeriesType = typename itk::Image< typename VolumeSeriesType::PixelType,
112  VolumeSeriesType::ImageDimension>;
113 #ifdef RTK_USE_CUDA
114  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
116  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension> >::type
118  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
119  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
120  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1> >::type
121  DVFImageType;
122  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
124  CudaWarpForwardProjectionImageFilter >::type
126  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
128  CudaWarpBackProjectionImageFilter >::type
130 #else
131  using DVFSequenceImageType = itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension>;
132  using DVFImageType = itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension-1>;
133  using WarpForwardProjectionImageFilterType = JosephForwardProjectionImageFilter<ProjectionStackType,
134  ProjectionStackType>;
135  using WarpBackProjectionImageFilterType = BackProjectionImageFilter<VolumeType, VolumeType>;
136 #endif
138  DVFImageType>;
139 #ifdef RTK_USE_CUDA
140  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
142  CudaCyclicDeformationImageFilter >::type
144 #else
145  using CudaCyclicDeformationImageFilterType = CPUDVFInterpolatorType;
146 #endif
147 
149  itkNewMacro(Self)
150 
151 
153 
155  void SetForwardProjectionFilter (const typename Superclass::ForwardProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "ForwardProjection cannot be changed");}
156  void SetBackProjectionFilter (const typename Superclass::BackProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "BackProjection cannot be changed");}
158 
160  void SetDisplacementField(const DVFSequenceImageType* DVFs);
161  void SetInverseDisplacementField(const DVFSequenceImageType* DVFs);
165 
167  void SetSignal(const std::vector<double> signal) override;
168 
170  itkSetMacro(UseCudaCyclicDeformation, bool)
171  itkGetMacro(UseCudaCyclicDeformation, bool)
172 
173 protected:
176 
178  void GenerateOutputInformation() override;
179 
181 #if ITK_VERSION_MAJOR<5
182  void VerifyInputInformation() override {}
183 #else
184  void VerifyInputInformation() const override {}
185 #endif
186 
187 
189  void GenerateData() override;
190 
194  std::vector<double> m_Signal;
196 };
197 } //namespace ITK
198 
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 #include "rtkMotionCompensatedFourDReconstructionConjugateGradientOperator.hxx"
202 #endif
203 
204 #endif
Base class for forward projection, i.e. accumulation along x-ray lines.
void SetInverseDisplacementField(const DVFSequenceImageType *DVFs)
DVFSequenceImageType::ConstPointer GetInverseDisplacementField()
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetDisplacementField(const DVFSequenceImageType *DVFs)
Implements part of the 4D reconstruction by conjugate gradient.
void SetSignal(const std::vector< double > signal) override
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension-1 > VectorForDVF
JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType > WarpForwardProjectionImageFilterType
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
#define itkSetMacro(name, type)