RTK  2.6.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  itkOverrideGetNameOfClassMacro(WarpFourDToProjectionStackImageFilter);
138 
139  using SignalVectorType = std::vector<double>;
140 
142  void
143  SetForwardProjectionFilter(typename Superclass::ForwardProjectionFilterType * itkNotUsed(_arg))
144  {
145  itkExceptionMacro(<< "ForwardProjection cannot be changed");
146  }
147 
149  void
150  SetDisplacementField(const DVFSequenceImageType * DisplacementField);
151  typename DVFSequenceImageType::ConstPointer
152  GetDisplacementField();
154 
155  void
156  SetSignal(const std::vector<double> signal) override;
157 
159  itkSetMacro(UseCudaCyclicDeformation, bool);
160  itkGetMacro(UseCudaCyclicDeformation, bool);
162 
163 protected:
165  ~WarpFourDToProjectionStackImageFilter() override = default;
166 
168  void
169  GenerateData() override;
170 
171  void
172  GenerateOutputInformation() override;
173 
174  void
175  GenerateInputRequestedRegion() override;
176 
179  void
180  VerifyInputInformation() const override
181  {}
182 
185  std::vector<double> m_Signal;
186  bool m_UseCudaCyclicDeformation{ false };
187 };
188 } // namespace rtk
189 
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 # include "rtkWarpFourDToProjectionStackImageFilter.hxx"
193 #endif
194 
195 #endif
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
typename itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension - 1 > DVFImageType
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetForwardProjectionFilter(typename Superclass::ForwardProjectionFilterType *)
#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