RTK  2.5.0
Reconstruction Toolkit
rtkWarpProjectionStackToFourDImageFilter.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 rtkWarpProjectionStackToFourDImageFilter_h
19 #define rtkWarpProjectionStackToFourDImageFilter_h
20 
23 
24 #ifdef RTK_USE_CUDA
27 #endif
28 
29 namespace rtk
30 {
84 template <typename VolumeSeriesType, typename ProjectionStackType>
85 class ITK_TEMPLATE_EXPORT WarpProjectionStackToFourDImageFilter
86  : public ProjectionStackToFourDImageFilter<VolumeSeriesType, ProjectionStackType>
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_MOVE(WarpProjectionStackToFourDImageFilter);
90 
95 
97  using VolumeType = ProjectionStackType;
98  using VectorForDVF = itk::CovariantVector<typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1>;
99 
101  using CPUVolumeSeriesType =
103 #ifdef RTK_USE_CUDA
104  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
106  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension>>::type
108  typedef
109  typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
110  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
111  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1>>::type DVFImageType;
112  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
114  CudaWarpBackProjectionImageFilter>::type WarpBackProjectionImageFilter;
116  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
118  CudaCyclicDeformationImageFilter>::type CudaCyclicDeformationImageFilterType;
119 #else
121  using DVFImageType = itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
125 #endif
126 
128  itkNewMacro(Self);
129 
131 #ifdef itkOverrideGetNameOfClassMacro
132  itkOverrideGetNameOfClassMacro(WarpProjectionStackToFourDImageFilter);
133 #else
135 #endif
136 
137 
138  using SignalVectorType = std::vector<double>;
139 
141  void
143  {
144  itkExceptionMacro(<< "BackProjection cannot be changed");
145  }
146 
148  void
149  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
150  typename DVFSequenceImageType::ConstPointer
151  GetDisplacementField();
153 
154  void
155  SetSignal(const std::vector<double> signal) override;
156 
158  itkSetMacro(UseCudaCyclicDeformation, bool);
159  itkGetMacro(UseCudaCyclicDeformation, bool);
161 
162 protected:
164  ~WarpProjectionStackToFourDImageFilter() override = default;
165 
167  void
168  GenerateData() override;
169 
170  void
171  GenerateOutputInformation() override;
172 
175  void
176  VerifyInputInformation() const override
177  {}
178 
181  std::vector<double> m_Signal;
183 };
184 } // namespace rtk
185 
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 # include "rtkWarpProjectionStackToFourDImageFilter.hxx"
189 #endif
190 
191 #endif
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetBackProjectionFilter(const typename Superclass::BackProjectionFilterType::Pointer)
#define itkSetMacro(name, type)
Implements part of the 4D reconstruction by conjugate gradient.
Back projection part for motion compensated iterative 4D reconstruction.
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType