RTK  2.0.1
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 {
85  template< typename VolumeSeriesType, typename ProjectionStackType>
86 class WarpFourDToProjectionStackImageFilter : public rtk::FourDToProjectionStackImageFilter<ProjectionStackType, VolumeSeriesType>
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_ASSIGN(WarpFourDToProjectionStackImageFilter);
90 
93  using Superclass = rtk::FourDToProjectionStackImageFilter< ProjectionStackType,
94  VolumeSeriesType>;
96 
98  using VolumeType = ProjectionStackType;
99  using VectorForDVF = itk::CovariantVector< typename VolumeSeriesType::ValueType,
100  VolumeSeriesType::ImageDimension - 1>;
101 
102  using CPUVolumeSeriesType = typename itk::Image< typename VolumeSeriesType::PixelType,
103  VolumeSeriesType::ImageDimension>;
104 #ifdef RTK_USE_CUDA
105 
106  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
108  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension> >::type
110  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
111  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
112  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1> >::type
113  DVFImageType;
114 #else
115  using DVFSequenceImageType = typename itk::Image<VectorForDVF,
116  VolumeSeriesType::ImageDimension>;
117  using DVFImageType = typename itk::Image<VectorForDVF,
118  VolumeSeriesType::ImageDimension - 1>;
119 #endif
121  DVFImageType>;
122 #ifdef RTK_USE_CUDA
123  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
125  CudaWarpForwardProjectionImageFilter >::type
127  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
129  CudaCyclicDeformationImageFilter >::type
131 #else
132  using WarpForwardProjectionImageFilterType = JosephForwardProjectionImageFilter< ProjectionStackType,
133  ProjectionStackType>;
134  using CudaCyclicDeformationImageFilterType = CPUDVFInterpolatorType;
135 #endif
136 
138  itkNewMacro(Self)
139 
140 
142 
143  using SignalVectorType = std::vector<double>;
144 
146  void SetForwardProjectionFilter (const typename Superclass::ForwardProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "ForwardProjection cannot be changed");}
147 
149  void SetDisplacementField(const DVFSequenceImageType* DVFs);
150  typename DVFSequenceImageType::ConstPointer GetDisplacementField();
152 
153  void SetSignal(const std::vector<double> signal) override;
154 
156  itkSetMacro(UseCudaCyclicDeformation, bool)
157  itkGetMacro(UseCudaCyclicDeformation, bool)
158 
159 protected:
161  ~WarpFourDToProjectionStackImageFilter() override = default;
162 
164  void GenerateData() override;
165 
166  void GenerateOutputInformation() override;
167 
168  void GenerateInputRequestedRegion() override;
169 
172 #if ITK_VERSION_MAJOR<5
173  void VerifyInputInformation() override {}
174 #else
175  void VerifyInputInformation() const override {}
176 #endif
177 
178 
181  std::vector<double> m_Signal;
183 
184 };
185 } //namespace ITK
186 
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "rtkWarpFourDToProjectionStackImageFilter.hxx"
190 #endif
191 
192 #endif
Base class for forward projection, i.e. accumulation along x-ray lines.
typename itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension-1 > DVFImageType
void SetForwardProjectionFilter(const typename Superclass::ForwardProjectionFilterType::Pointer)
STL namespace.
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetDisplacementField(const DVFSequenceImageType *DVFs)
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension-1 > VectorForDVF
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CPUDVFInterpolatorType
void SetSignal(const std::vector< double > signal) override
JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType > WarpForwardProjectionImageFilterType
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
DVFSequenceImageType::ConstPointer GetDisplacementField()
#define itkSetMacro(name, type)
~WarpFourDToProjectionStackImageFilter() override=default