RTK  2.0.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 {
85  template< typename VolumeSeriesType, typename ProjectionStackType>
86 class WarpFourDToProjectionStackImageFilter : public rtk::FourDToProjectionStackImageFilter<ProjectionStackType, VolumeSeriesType>
87 {
88 public:
91  typedef rtk::FourDToProjectionStackImageFilter< ProjectionStackType,
92  VolumeSeriesType> Superclass;
94 
96  typedef ProjectionStackType VolumeType;
97  typedef itk::CovariantVector< typename VolumeSeriesType::ValueType,
98  VolumeSeriesType::ImageDimension - 1> VectorForDVF;
99 
100  typedef typename itk::Image< typename VolumeSeriesType::PixelType,
101  VolumeSeriesType::ImageDimension> CPUVolumeSeriesType;
102 #ifdef RTK_USE_CUDA
103 
104  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
106  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension> >::type
108  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
109  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
110  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1> >::type
111  DVFImageType;
112 #else
113  typedef typename itk::Image<VectorForDVF,
114  VolumeSeriesType::ImageDimension> DVFSequenceImageType;
115  typedef typename itk::Image<VectorForDVF,
116  VolumeSeriesType::ImageDimension - 1> DVFImageType;
117 #endif
119  DVFImageType> CPUDVFInterpolatorType;
120 #ifdef RTK_USE_CUDA
121  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
123  CudaWarpForwardProjectionImageFilter >::type
125  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
127  CudaCyclicDeformationImageFilter >::type
129 #else
130  typedef JosephForwardProjectionImageFilter< ProjectionStackType,
132  typedef CPUDVFInterpolatorType CudaCyclicDeformationImageFilterType;
133 #endif
134 
136  itkNewMacro(Self)
137 
138 
140 
141  typedef std::vector<double> SignalVectorType;
142 
144  void SetForwardProjectionFilter (const typename Superclass::ForwardProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "ForwardProjection cannot be changed");}
145 
147  void SetDisplacementField(const DVFSequenceImageType* DVFs);
148  typename DVFSequenceImageType::ConstPointer GetDisplacementField();
150 
151  void SetSignal(const std::vector<double> signal) ITK_OVERRIDE;
152 
154  itkSetMacro(UseCudaCyclicDeformation, bool)
155  itkGetMacro(UseCudaCyclicDeformation, bool)
156 
157 protected:
159  virtual ~WarpFourDToProjectionStackImageFilter() ITK_OVERRIDE {}
160 
162  void GenerateData() ITK_OVERRIDE;
163 
164  void GenerateOutputInformation() ITK_OVERRIDE;
165 
166  void GenerateInputRequestedRegion() ITK_OVERRIDE;
167 
170 #if ITK_VERSION_MAJOR<5
171  void VerifyInputInformation() ITK_OVERRIDE {}
172 #else
173  void VerifyInputInformation() const ITK_OVERRIDE {}
174 #endif
175 
176 
179  std::vector<double> m_Signal;
181 
182 private:
183  WarpFourDToProjectionStackImageFilter(const Self &); //purposely not implemented
184  void operator=(const Self &); //purposely not implemented
185 
186 };
187 } //namespace ITK
188 
189 
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "rtkWarpFourDToProjectionStackImageFilter.hxx"
192 #endif
193 
194 #endif
Base class for forward projection, i.e. accumulation along x-ray lines.
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension-1 > VectorForDVF
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType
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...
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CPUDVFInterpolatorType
void SetDisplacementField(const DVFSequenceImageType *DVFs)
rtk::FourDToProjectionStackImageFilter< ProjectionStackType, VolumeSeriesType > Superclass
itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
void SetSignal(const std::vector< double > signal) override
Forward projection part for motion compensated iterative 4D reconstruction.
Implements part of the 4D reconstruction by conjugate gradient.
DVFSequenceImageType::ConstPointer GetDisplacementField()
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension-1 > DVFImageType
#define itkSetMacro(name, type)
JosephForwardProjectionImageFilter< ProjectionStackType, ProjectionStackType > WarpForwardProjectionImageFilterType