RTK  2.0.0
Reconstruction Toolkit
rtkWarpProjectionStackToFourDImageFilter.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 rtkWarpProjectionStackToFourDImageFilter_h
19 #define rtkWarpProjectionStackToFourDImageFilter_h
20 
23 
24 #ifdef RTK_USE_CUDA
27 #endif
28 
29 namespace rtk
30 {
83 template< typename VolumeSeriesType, typename ProjectionStackType>
84 class WarpProjectionStackToFourDImageFilter : public ProjectionStackToFourDImageFilter< VolumeSeriesType, ProjectionStackType>
85 {
86 public:
89  typedef ProjectionStackToFourDImageFilter< VolumeSeriesType,
90  ProjectionStackType> Superclass;
92 
94  typedef ProjectionStackType VolumeType;
95  typedef itk::CovariantVector< typename VolumeSeriesType::ValueType,
96  VolumeSeriesType::ImageDimension - 1> VectorForDVF;
97 
99  typedef typename itk::Image< typename VolumeSeriesType::PixelType,
100  VolumeSeriesType::ImageDimension> CPUVolumeSeriesType;
101 #ifdef RTK_USE_CUDA
102  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
104  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension> >::type
106  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
107  itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension - 1>,
108  itk::CudaImage<VectorForDVF, VolumeSeriesType::ImageDimension - 1> >::type
109  DVFImageType;
110  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
112  CudaWarpBackProjectionImageFilter >::type
115  DVFImageType> CPUDVFInterpolatorType;
116  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
118  CudaCyclicDeformationImageFilter >::type
120 #else
121  typedef itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension> DVFSequenceImageType;
122  typedef itk::Image<VectorForDVF,
123  VolumeSeriesType::ImageDimension - 1> DVFImageType;
124  typedef BackProjectionImageFilter<VolumeType, VolumeType> WarpBackProjectionImageFilter;
126  DVFImageType> CPUDVFInterpolatorType;
127  typedef CPUDVFInterpolatorType CudaCyclicDeformationImageFilterType;
128 #endif
129 
131  itkNewMacro(Self)
132 
133 
135 
136  typedef std::vector<double> SignalVectorType;
137 
139  void SetBackProjectionFilter (const typename Superclass::BackProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "BackProjection cannot be changed");}
140 
142  void SetDisplacementField(const DVFSequenceImageType* DVFs);
143  typename DVFSequenceImageType::ConstPointer GetDisplacementField();
145 
146  void SetSignal(const std::vector<double> signal) ITK_OVERRIDE;
147 
149  itkSetMacro(UseCudaCyclicDeformation, bool)
150  itkGetMacro(UseCudaCyclicDeformation, bool)
151 
152 protected:
154  virtual ~WarpProjectionStackToFourDImageFilter() ITK_OVERRIDE {}
155 
157  void GenerateData() ITK_OVERRIDE;
158 
159  void GenerateOutputInformation() ITK_OVERRIDE;
160 
163 #if ITK_VERSION_MAJOR<5
164  void VerifyInputInformation() ITK_OVERRIDE {}
165 #else
166  void VerifyInputInformation() const ITK_OVERRIDE {}
167 #endif
168 
169 
172  std::vector<double> m_Signal;
174 
175 private:
176  WarpProjectionStackToFourDImageFilter(const Self &); //purposely not implemented
177  void operator=(const Self &); //purposely not implemented
178 
179 };
180 } //namespace ITK
181 
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "rtkWarpProjectionStackToFourDImageFilter.hxx"
185 #endif
186 
187 #endif
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension-1 > DVFImageType
STL namespace.
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number...
void SetBackProjectionFilter(const typename Superclass::BackProjectionFilterType::Pointer)
DVFSequenceImageType::ConstPointer GetDisplacementField()
void SetSignal(const std::vector< double > signal) override
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CPUDVFInterpolatorType
void SetDisplacementField(const DVFSequenceImageType *DVFs)
BackProjectionImageFilter< VolumeType, VolumeType > WarpBackProjectionImageFilter
itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
Implements part of the 4D reconstruction by conjugate gradient.
Back projection part for motion compensated iterative 4D reconstruction.
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension-1 > VectorForDVF
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType
#define itkSetMacro(name, type)
ProjectionStackToFourDImageFilter< VolumeSeriesType, ProjectionStackType > Superclass