RTK  2.0.0
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:
103 
105  typedef ProjectionStackType VolumeType;
106  typedef itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1> VectorForDVF;
107 
109  typedef typename itk::Image< typename VolumeSeriesType::PixelType,
110  VolumeSeriesType::ImageDimension> CPUVolumeSeriesType;
111 #ifdef RTK_USE_CUDA
112  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
114  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension> >::type
116  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
117  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
118  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1> >::type
119  DVFImageType;
120  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
122  CudaWarpForwardProjectionImageFilter >::type
124  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
126  CudaWarpBackProjectionImageFilter >::type
128 #else
129  typedef itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension> DVFSequenceImageType;
130  typedef itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension-1> DVFImageType;
131  typedef JosephForwardProjectionImageFilter<ProjectionStackType,
133  typedef BackProjectionImageFilter<VolumeType, VolumeType> WarpBackProjectionImageFilterType;
134 #endif
136  DVFImageType> CPUDVFInterpolatorType;
137 #ifdef RTK_USE_CUDA
138  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
140  CudaCyclicDeformationImageFilter >::type
142 #else
143  typedef CPUDVFInterpolatorType CudaCyclicDeformationImageFilterType;
144 #endif
145 
147  itkNewMacro(Self)
148 
149 
151 
153  void SetForwardProjectionFilter (const typename Superclass::ForwardProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "ForwardProjection cannot be changed");}
154  void SetBackProjectionFilter (const typename Superclass::BackProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "BackProjection cannot be changed");}
156 
158  void SetDisplacementField(const DVFSequenceImageType* DVFs);
159  void SetInverseDisplacementField(const DVFSequenceImageType* DVFs);
160  typename DVFSequenceImageType::ConstPointer GetInverseDisplacementField();
161  typename DVFSequenceImageType::ConstPointer GetDisplacementField();
163 
165  void SetSignal(const std::vector<double> signal) ITK_OVERRIDE;
166 
168  itkSetMacro(UseCudaCyclicDeformation, bool)
169  itkGetMacro(UseCudaCyclicDeformation, bool)
170 
171 protected:
174 
176  void GenerateOutputInformation() ITK_OVERRIDE;
177 
179 #if ITK_VERSION_MAJOR<5
180  void VerifyInputInformation() ITK_OVERRIDE {}
181 #else
182  void VerifyInputInformation() const ITK_OVERRIDE {}
183 #endif
184 
185 
187  void GenerateData() ITK_OVERRIDE;
188 
192  std::vector<double> m_Signal;
194 
195 private:
196  MotionCompensatedFourDReconstructionConjugateGradientOperator(const Self &); //purposely not implemented
197  void operator=(const Self &); //purposely not implemented
198 };
199 } //namespace ITK
200 
201 
202 #ifndef ITK_MANUAL_INSTANTIATION
203 #include "rtkMotionCompensatedFourDReconstructionConjugateGradientOperator.hxx"
204 #endif
205 
206 #endif
Base class for forward projection, i.e. accumulation along x-ray lines.
void SetInverseDisplacementField(const DVFSequenceImageType *DVFs)
FourDReconstructionConjugateGradientOperator< VolumeSeriesType, ProjectionStackType > Superclass
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
itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
#define itkSetMacro(name, type)