RTK  2.7.0
Reconstruction Toolkit
rtkWarpFourDToProjectionStackImageFilter.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 rtkWarpFourDToProjectionStackImageFilter_h
19 #define rtkWarpFourDToProjectionStackImageFilter_h
20 
24 #include <vector>
25 
26 #ifdef RTK_USE_CUDA
29 #endif
30 
31 namespace rtk
32 {
87 template <typename VolumeSeriesType, typename ProjectionStackType>
88 class ITK_TEMPLATE_EXPORT WarpFourDToProjectionStackImageFilter
89  : public rtk::FourDToProjectionStackImageFilter<ProjectionStackType, VolumeSeriesType>
90 {
91 public:
92  ITK_DISALLOW_COPY_AND_MOVE(WarpFourDToProjectionStackImageFilter);
93 
98 
100  using VolumeType = ProjectionStackType;
101  using VectorForDVF = itk::CovariantVector<typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1>;
102 
103  using CPUVolumeSeriesType =
105 #ifdef RTK_USE_CUDA
106 
107  using DVFSequenceImageType =
108  typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
110  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension>>;
111  using DVFImageType = typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
112  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
113  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1>>;
114 #else
116  using DVFImageType = typename itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
117 #endif
119 #ifdef RTK_USE_CUDA
121  typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
125  typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
128 #else
132 #endif
133 
135  itkNewMacro(Self);
136 
138  itkOverrideGetNameOfClassMacro(WarpFourDToProjectionStackImageFilter);
139 
140  using SignalVectorType = std::vector<double>;
141 
143  void
144  SetForwardProjectionFilter(typename Superclass::ForwardProjectionFilterType * itkNotUsed(_arg))
145  {
146  itkExceptionMacro(<< "ForwardProjection cannot be changed");
147  }
148 
150  void
151  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
152  typename DVFSequenceImageType::ConstPointer
153  GetDisplacementField();
155 
156  void
157  SetSignal(const std::vector<double> signal) override;
158 
160  itkSetMacro(UseCudaCyclicDeformation, bool);
161  itkGetMacro(UseCudaCyclicDeformation, bool);
163 
164 protected:
166  ~WarpFourDToProjectionStackImageFilter() override = default;
167 
169  void
170  GenerateData() override;
171 
172  void
173  GenerateOutputInformation() override;
174 
175  void
176  GenerateInputRequestedRegion() override;
177 
180  void
181  VerifyInputInformation() const override
182  {}
183 
186  std::vector<double> m_Signal;
187  bool m_UseCudaCyclicDeformation{ false };
188 };
189 } // namespace rtk
190 
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 # include "rtkWarpFourDToProjectionStackImageFilter.hxx"
194 #endif
195 
196 #endif
typename std::conditional_t< std::is_same_v< VolumeSeriesType, CPUVolumeSeriesType >, itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension - 1 >, itk::CudaImage< VectorForDVF, VolumeSeriesType::ImageDimension - 1 > > DVFImageType
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
typename std::conditional_t< std::is_same_v< VolumeSeriesType, CPUVolumeSeriesType >, JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType >, CudaWarpForwardProjectionImageFilter > WarpForwardProjectionImageFilterType
typename std::conditional_t< std::is_same_v< VolumeSeriesType, CPUVolumeSeriesType >, itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension >, itk::CudaImage< VectorForDVF, VolumeSeriesType::ImageDimension > > DVFSequenceImageType
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetForwardProjectionFilter(typename Superclass::ForwardProjectionFilterType *)
typename std::conditional_t< std::is_same_v< VolumeSeriesType, CPUVolumeSeriesType >, CPUDVFInterpolatorType, CudaCyclicDeformationImageFilter > CudaCyclicDeformationImageFilterType
#define itkSetMacro(name, type)
GPU version of the temporal DVF interpolator.
Forward projection part for motion compensated iterative 4D reconstruction.
Implements part of the 4D reconstruction by conjugate gradient.