RTK  2.1.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  * http://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>
89  : public rtk::FourDToProjectionStackImageFilter<ProjectionStackType, VolumeSeriesType>
90 {
91 public:
92 #if ITK_VERSION_MAJOR == 5 && ITK_VERSION_MINOR == 1
93  ITK_DISALLOW_COPY_AND_ASSIGN(WarpFourDToProjectionStackImageFilter);
94 #else
95  ITK_DISALLOW_COPY_AND_MOVE(WarpFourDToProjectionStackImageFilter);
96 #endif
97 
102 
104  using VolumeType = ProjectionStackType;
105  using VectorForDVF = itk::CovariantVector<typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1>;
106 
107  using CPUVolumeSeriesType =
109 #ifdef RTK_USE_CUDA
110 
111  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
113  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension>>::type
115  typedef
116  typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
117  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
118  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1>>::type DVFImageType;
119 #else
121  using DVFImageType = typename itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>;
122 #endif
124 #ifdef RTK_USE_CUDA
125  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
127  CudaWarpForwardProjectionImageFilter>::type WarpForwardProjectionImageFilterType;
128  typedef typename std::conditional<std::is_same<VolumeSeriesType, CPUVolumeSeriesType>::value,
130  CudaCyclicDeformationImageFilter>::type CudaCyclicDeformationImageFilterType;
131 #else
135 #endif
136 
138  itkNewMacro(Self);
139 
142 
143  using SignalVectorType = std::vector<double>;
144 
146  void
148  {
149  itkExceptionMacro(<< "ForwardProjection cannot be changed");
150  }
151 
153  void
154  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
155  typename DVFSequenceImageType::ConstPointer
158 
159  void
160  SetSignal(const std::vector<double> signal) override;
161 
163  itkSetMacro(UseCudaCyclicDeformation, bool);
164  itkGetMacro(UseCudaCyclicDeformation, bool);
166 
167 protected:
169  ~WarpFourDToProjectionStackImageFilter() override = default;
170 
172  void
173  GenerateData() override;
174 
175  void
176  GenerateOutputInformation() override;
177 
178  void
179  GenerateInputRequestedRegion() override;
180 
183  void
184  VerifyInputInformation() const override
185  {}
186 
189  std::vector<double> m_Signal;
191 };
192 } // namespace rtk
193 
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 # include "rtkWarpFourDToProjectionStackImageFilter.hxx"
197 #endif
198 
199 #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)
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension - 1 > VectorForDVF
JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType > WarpForwardProjectionImageFilterType
void SetSignal(const std::vector< double > signal) override
void SetDisplacementField(const DVFSequenceImageType *DisplacementField)
Forward projection part for motion compensated iterative 4D reconstruction.
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CPUDVFInterpolatorType
Implements part of the 4D reconstruction by conjugate gradient.
typename itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType
DVFSequenceImageType::ConstPointer GetDisplacementField()
~WarpFourDToProjectionStackImageFilter() override=default