RTK  2.0.1
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:
87  ITK_DISALLOW_COPY_AND_ASSIGN(WarpProjectionStackToFourDImageFilter);
88 
91  using Superclass = ProjectionStackToFourDImageFilter< VolumeSeriesType,
92  ProjectionStackType>;
94 
96  using VolumeType = ProjectionStackType;
97  using VectorForDVF = itk::CovariantVector< typename VolumeSeriesType::ValueType,
98  VolumeSeriesType::ImageDimension - 1>;
99 
101  using CPUVolumeSeriesType = typename itk::Image< typename VolumeSeriesType::PixelType,
102  VolumeSeriesType::ImageDimension>;
103 #ifdef RTK_USE_CUDA
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  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
114  CudaWarpBackProjectionImageFilter >::type
117  DVFImageType>;
118  typedef typename std::conditional< std::is_same< VolumeSeriesType, CPUVolumeSeriesType >::value,
120  CudaCyclicDeformationImageFilter >::type
122 #else
123  using DVFSequenceImageType = itk::Image<VectorForDVF, VolumeSeriesType::ImageDimension>;
124  using DVFImageType = itk::Image<VectorForDVF,
125  VolumeSeriesType::ImageDimension - 1>;
126  using WarpBackProjectionImageFilter = BackProjectionImageFilter<VolumeType, VolumeType>;
127  using CPUDVFInterpolatorType = CyclicDeformationImageFilter< DVFSequenceImageType,
128  DVFImageType>;
129  using CudaCyclicDeformationImageFilterType = CPUDVFInterpolatorType;
130 #endif
131 
133  itkNewMacro(Self)
134 
135 
137 
138  using SignalVectorType = std::vector<double>;
139 
141  void SetBackProjectionFilter (const typename Superclass::BackProjectionFilterType::Pointer itkNotUsed(_arg)) {itkExceptionMacro(<< "BackProjection cannot be changed");}
142 
144  void SetDisplacementField(const DVFSequenceImageType* DVFs);
145  typename DVFSequenceImageType::ConstPointer GetDisplacementField();
147 
148  void SetSignal(const std::vector<double> signal) override;
149 
151  itkSetMacro(UseCudaCyclicDeformation, bool)
152  itkGetMacro(UseCudaCyclicDeformation, bool)
153 
154 protected:
156  ~WarpProjectionStackToFourDImageFilter() override = default;
157 
159  void GenerateData() override;
160 
161  void GenerateOutputInformation() override;
162 
165 #if ITK_VERSION_MAJOR<5
166  void VerifyInputInformation() override {}
167 #else
168  void VerifyInputInformation() const override {}
169 #endif
170 
171 
174  std::vector<double> m_Signal;
176 
177 };
178 } //namespace ITK
179 
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "rtkWarpProjectionStackToFourDImageFilter.hxx"
183 #endif
184 
185 #endif
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension-1 > DVFImageType
BackProjectionImageFilter< VolumeType, VolumeType > WarpBackProjectionImageFilter
~WarpProjectionStackToFourDImageFilter() override=default
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
typename itk::Image< typename VolumeSeriesType::PixelType, VolumeSeriesType::ImageDimension > CPUVolumeSeriesType
void SetDisplacementField(const DVFSequenceImageType *DVFs)
itk::CovariantVector< typename VolumeSeriesType::ValueType, VolumeSeriesType::ImageDimension-1 > VectorForDVF
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CPUDVFInterpolatorType
Implements part of the 4D reconstruction by conjugate gradient.
Back projection part for motion compensated iterative 4D reconstruction.
itk::Image< VectorForDVF, VolumeSeriesType::ImageDimension > DVFSequenceImageType
#define itkSetMacro(name, type)