ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkWarpSequenceImageFilter.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
19#ifndef rtkWarpSequenceImageFilter_h
20#define rtkWarpSequenceImageFilter_h
21
23
24#include <itkCastImageFilter.h>
27#include <itkPasteImageFilter.h>
28
29#ifdef RTK_USE_CUDA
33#else
34# include <itkWarpImageFilter.h>
37#endif
38
39namespace rtk
40{
88
89template <typename TImageSequence,
90 typename TDVFImageSequence =
91 itk::Image<itk::CovariantVector<typename TImageSequence::ValueType, TImageSequence::ImageDimension - 1>,
92 TImageSequence::ImageDimension>,
93 typename TImage = itk::Image<typename TImageSequence::ValueType, TImageSequence::ImageDimension - 1>,
94 typename TDVFImage =
95 itk::Image<itk::CovariantVector<typename TImageSequence::ValueType, TImageSequence::ImageDimension - 1>,
96 TImageSequence::ImageDimension - 1>>
97class ITK_TEMPLATE_EXPORT WarpSequenceImageFilter : public itk::ImageToImageFilter<TImageSequence, TImageSequence>
98{
99public:
100 ITK_DISALLOW_COPY_AND_MOVE(WarpSequenceImageFilter);
101
106
108 itkNewMacro(Self);
109
113#ifdef RTK_USE_CUDA
114 using WarpFilterType =
115 typename std::conditional_t<std::is_same_v<TImage, CPUImageType>, CPUWarpFilterType, CudaWarpImageFilter>;
116 using ForwardWarpFilterType = typename std::conditional_t<std::is_same_v<TImage, CPUImageType>,
118 CudaForwardWarpImageFilter>;
120 typename std::conditional_t<std::is_same_v<TImage, CPUImageType>,
122 CudaCyclicDeformationImageFilter>;
123#else
127#endif
128
130 itkOverrideGetNameOfClassMacro(WarpSequenceImageFilter);
131
133 void
134 SetDisplacementField(const TDVFImageSequence * DVFs);
135
137 typename TDVFImageSequence::Pointer
139
141 itkGetMacro(ForwardWarp, bool);
142 itkSetMacro(ForwardWarp, bool);
143
145 itkSetMacro(PhaseShift, float);
146 itkGetMacro(PhaseShift, float);
147
149 itkSetMacro(UseNearestNeighborInterpolationInWarping, bool);
150 itkGetMacro(UseNearestNeighborInterpolationInWarping, bool);
151
153 itkSetMacro(UseCudaCyclicDeformation, bool);
154 itkGetMacro(UseCudaCyclicDeformation, bool);
155
164
165protected:
167 ~WarpSequenceImageFilter() override = default;
168
170 void
171 GenerateData() override;
172
174 typename CPUWarpFilterType::Pointer m_WarpFilter;
180
182 typename TImageSequence::RegionType m_ExtractAndPasteRegion;
183
187
191 void
192 VerifyInputInformation() const override
193 {}
194
197 void
199 void
201
202 bool m_UseNearestNeighborInterpolationInWarping; // Default is false, linear interpolation is used instead
204};
205} // namespace rtk
206
207
208#ifndef ITK_MANUAL_INSTANTIATION
209# include "rtkWarpSequenceImageFilter.hxx"
210#endif
211
212#endif
Casts input pixels to output pixel type.
SmartPointer< Self > Pointer
A templated class holding a n-Dimensional covariant vector.
Decrease the image size by cropping the image to the selected region bounds.
Base class for filters that take an image as input and produce an image as output.
Templated n-dimensional image class.
Definition itkImage.h:89
Linearly interpolate an image at specified positions.
Paste an image (or a constant value) into another image.
SmartPointer< Self > Pointer
Implements transparent reference counting.
Warps an image using an input displacement field.
Generate an n-dimensional image with constant pixel values.
Return 3D deformation vector field according to input 4D vector field, phase signal and frame number.
Warps an image using splat instead of interpolation.
CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > CudaCyclicDeformationImageFilterType
rtk::CyclicDeformationImageFilter< DVFSequenceImageType, DVFImageType > DVFInterpolatorType
itk::NearestNeighborInterpolateImageFunction< VolumeType, double > NearestNeighborInterpolatorType
TDVFImageSequence::Pointer GetDisplacementField()
void GenerateOutputInformation() override
void GenerateInputRequestedRegion() override
typename itk::WarpImageFilter< VolumeType, VolumeType, DVFImageType > CPUWarpFilterType
typename itk::Image< typename VolumeType::PixelType, VolumeType::ImageDimension > CPUImageType
~WarpSequenceImageFilter() override=default
void GenerateData() override
void SetDisplacementField(const TDVFImageSequence *DVFs)
#define itkSetMacro(name, type)