RTK  2.6.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  itkOverrideGetNameOfClassMacro(WarpProjectionStackToFourDImageFilter);
132 
133  using SignalVectorType = std::vector<double>;
134 
136  void
137  SetBackProjectionFilter(typename Superclass::BackProjectionFilterType * itkNotUsed(_arg))
138  {
139  itkExceptionMacro(<< "BackProjection cannot be changed");
140  }
141 
143  void
144  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
145  typename DVFSequenceImageType::ConstPointer
146  GetDisplacementField();
148 
149  void
150  SetSignal(const std::vector<double> signal) override;
151 
153  itkSetMacro(UseCudaCyclicDeformation, bool);
154  itkGetMacro(UseCudaCyclicDeformation, bool);
156 
157 protected:
159  ~WarpProjectionStackToFourDImageFilter() override = default;
160 
162  void
163  GenerateData() override;
164 
165  void
166  GenerateOutputInformation() override;
167 
170  void
171  VerifyInputInformation() const override
172  {}
173 
176  std::vector<double> m_Signal;
178 };
179 } // namespace rtk
180 
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 # include "rtkWarpProjectionStackToFourDImageFilter.hxx"
184 #endif
185 
186 #endif
void SetBackProjectionFilter(typename Superclass::BackProjectionFilterType *)
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
#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