RTK  2.5.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  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
109  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension>>::type
111  typedef
112  typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
113  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
114  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1>>::type DVFImageType;
115 #else
117  using DVFImageType = typename itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
118 #endif
120 #ifdef RTK_USE_CUDA
121  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
123  CudaWarpForwardProjectionImageFilter>::type WarpForwardProjectionImageFilterType;
124  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
126  CudaCyclicDeformationImageFilter>::type CudaCyclicDeformationImageFilterType;
127 #else
131 #endif
132 
134  itkNewMacro(Self);
135 
137 #ifdef itkOverrideGetNameOfClassMacro
138  itkOverrideGetNameOfClassMacro(WarpFourDToProjectionStackImageFilter);
139 #else
141 #endif
142 
143 
144  using SignalVectorType = std::vector<double>;
145 
147  void
149  {
150  itkExceptionMacro(<< "ForwardProjection cannot be changed");
151  }
152 
154  void
155  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
156  typename DVFSequenceImageType::ConstPointer
157  GetDisplacementField();
159 
160  void
161  SetSignal(const std::vector<double> signal) override;
162 
164  itkSetMacro(UseCudaCyclicDeformation, bool);
165  itkGetMacro(UseCudaCyclicDeformation, bool);
167 
168 protected:
170  ~WarpFourDToProjectionStackImageFilter() override = default;
171 
173  void
174  GenerateData() override;
175 
176  void
177  GenerateOutputInformation() override;
178 
179  void
180  GenerateInputRequestedRegion() override;
181 
184  void
185  VerifyInputInformation() const override
186  {}
187 
190  std::vector<double> m_Signal;
191  bool m_UseCudaCyclicDeformation{ false };
192 };
193 } // namespace rtk
194 
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 # include "rtkWarpFourDToProjectionStackImageFilter.hxx"
198 #endif
199 
200 #endif
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
typename itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension - 1 > DVFImageType
void SetForwardProjectionFilter(const typename Superclass::ForwardProjectionFilterType::Pointer)
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
#define itkSetMacro(name, type)
Forward projection part for motion compensated iterative 4D reconstruction.
Implements part of the 4D reconstruction by conjugate gradient.
typename itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType