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  using CPUVolumeSeriesType =
104  using DVFSequenceImageType =
105  typename VolumeSeriesType::template RebindImageType<VectorForDVF, VolumeSeriesType::ImageDimension>;
106  using DVFImageType =
107  typename VolumeSeriesType::template RebindImageType<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
109 
110 #ifdef RTK_USE_CUDA
112  typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
116  typename std::conditional_t<std::is_same_v<VolumeSeriesType, CPUVolumeSeriesType>,
119 #else
123 #endif
124 
126  itkNewMacro(Self);
127 
129  itkOverrideGetNameOfClassMacro(WarpFourDToProjectionStackImageFilter);
130 
131  using SignalVectorType = std::vector<double>;
132 
134  void
135  SetForwardProjectionFilter(typename Superclass::ForwardProjectionFilterType * itkNotUsed(_arg))
136  {
137  itkExceptionMacro(<< "ForwardProjection cannot be changed");
138  }
139 
141  void
142  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
143  typename DVFSequenceImageType::ConstPointer
144  GetDisplacementField();
146 
147  void
148  SetSignal(const std::vector<double> signal) override;
149 
151  itkSetMacro(UseCudaCyclicDeformation, bool);
152  itkGetMacro(UseCudaCyclicDeformation, bool);
154 
155 protected:
157  ~WarpFourDToProjectionStackImageFilter() override = default;
158 
160  void
161  GenerateData() override;
162 
163  void
164  GenerateOutputInformation() override;
165 
166  void
167  GenerateInputRequestedRegion() override;
168 
171  void
172  VerifyInputInformation() const override
173  {}
174 
177  std::vector<double> m_Signal;
178  bool m_UseCudaCyclicDeformation{ false };
179 };
180 } // namespace rtk
181 
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 # include "rtkWarpFourDToProjectionStackImageFilter.hxx"
185 #endif
186 
187 #endif
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
typename std::conditional_t< std::is_same_v< VolumeSeriesType, CPUVolumeSeriesType >, JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType >, CudaWarpForwardProjectionImageFilter > WarpForwardProjectionImageFilterType
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.
typename VolumeSeriesType::template RebindImageType< VectorForDVF, VolumeSeriesType::ImageDimension - 1 > DVFImageType
Forward projection part for motion compensated iterative 4D reconstruction.
Implements part of the 4D reconstruction by conjugate gradient.
typename VolumeSeriesType::template RebindImageType< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType