Loading...
Searching...
No Matches
itkGPUResampleImageFilter.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkGPUResampleImageFilter_h
#define itkGPUResampleImageFilter_h
#include "itkResampleImageFilter.h"
#include "itkGPUImageToImageFilter.h"
#include "itkGPUInterpolateImageFunction.h"
#include "itkGPUBSplineInterpolateImageFunction.h"
#include "itkGPUBSplineBaseTransform.h"
#include "itkGPUTransformBase.h"
#include "itkGPUCompositeTransformBase.h"
namespace itk
{
itkGPUKernelClassMacro(GPUResampleImageFilterKernel);
template <typename TInputImage,
typename TOutputImage,
typename TInterpolatorPrecisionType = float,
typename TTransformPrecisionType = TInterpolatorPrecisionType>
class ITK_EXPORT GPUResampleImageFilter
: public GPUImageToImageFilter<
TInputImage,
TOutputImage,
ResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType>>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(GPUResampleImageFilter);
using Self = GPUResampleImageFilter;
using CPUSuperclass =
ResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType>;
using GPUSuperclass = GPUImageToImageFilter<TInputImage, TOutputImage, CPUSuperclass>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(GPUResampleImageFilter, GPUSuperclass);
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
using InputImageType = TInputImage;
using OutputImageType = TOutputImage;
using GPUInputImage = typename GPUTraits<TInputImage>::Type;
using GPUOutputImage = typename GPUTraits<TOutputImage>::Type;
using InterpolatorPrecisionType = TInterpolatorPrecisionType;
using InterpolatorType = typename CPUSuperclass::InterpolatorType;
using TransformType = typename CPUSuperclass::TransformType;
using ExtrapolatorType = typename CPUSuperclass::ExtrapolatorType;
using InputImageRegionType = typename CPUSuperclass::InputImageRegionType;
using OutputImageRegionType = typename CPUSuperclass::OutputImageRegionType;
using SizeType = typename CPUSuperclass::SizeType;
using IndexType = typename CPUSuperclass::IndexType;
using OutputImagePixelType = typename GPUSuperclass::OutputImagePixelType;
using GPUKernelManagerPointer = typename OpenCLKernelManager::Pointer;
using GPUDataManagerPointer = typename GPUDataManager::Pointer;
using CompositeTransformBaseType = GPUCompositeTransformBase<InterpolatorPrecisionType, InputImageDimension>;
using GPUBSplineInterpolatorType = GPUBSplineInterpolateImageFunction<InputImageType, InterpolatorPrecisionType>;
using GPUBSplineInterpolatorCoefficientImageType = typename GPUBSplineInterpolatorType::GPUCoefficientImageType;
using GPUBSplineInterpolatorCoefficientImagePointer = typename GPUBSplineInterpolatorType::GPUCoefficientImagePointer;
using GPUBSplineInterpolatorDataManagerPointer = typename GPUBSplineInterpolatorType::GPUDataManagerPointer;
using GPUBSplineBaseTransformType = GPUBSplineBaseTransform<InterpolatorPrecisionType, InputImageDimension>;
void
SetInterpolator(InterpolatorType * _arg) override;
void
SetExtrapolator(ExtrapolatorType * _arg) override;
void
SetTransform(const TransformType * _arg) override;
itkSetMacro(RequestedNumberOfSplits, unsigned int);
itkGetConstMacro(RequestedNumberOfSplits, unsigned int);
protected:
GPUResampleImageFilter();
~GPUResampleImageFilter() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
void
GPUGenerateData() override;
// Supported GPU transform types
enum GPUTransformTypeEnum
{
IdentityTransform = 1,
MatrixOffsetTransform,
TranslationTransform,
BSplineTransform,
Else
};
void
SetArgumentsForPreKernelManager(const typename GPUOutputImage::Pointer & output);
void
SetArgumentsForLoopKernelManager(const typename GPUInputImage::Pointer & input,
const typename GPUOutputImage::Pointer & output);
void
SetTransformParametersForLoopKernelManager(const std::size_t transformIndex);
void
SetArgumentsForPostKernelManager(const typename GPUInputImage::Pointer & input,
const typename GPUOutputImage::Pointer & output);
void
SetBSplineTransformCoefficientsToGPU(const std::size_t transformIndex);
const GPUTransformTypeEnum
GetTransformType(const int & transformIndex) const;
bool
HasTransform(const GPUTransformTypeEnum type) const;
int
GetTransformHandle(const GPUTransformTypeEnum type) const;
bool
GetKernelIdFromTransformId(const std::size_t & index, std::size_t & kernelId) const;
GPUBSplineBaseTransformType *
GetGPUBSplineBaseTransform(const std::size_t transformIndex);
private:
GPUInterpolatorBase * m_InterpolatorBase{};
GPUTransformBase * m_TransformBase{};
GPUDataManagerPointer m_InputGPUImageBase{};
GPUDataManagerPointer m_OutputGPUImageBase{};
GPUDataManagerPointer m_FilterParameters{};
GPUDataManagerPointer m_DeformationFieldBuffer{};
unsigned int m_RequestedNumberOfSplits{};
using TransformHandle = std::pair<int, bool>;
using TransformsHandle = std::map<GPUTransformTypeEnum, TransformHandle>;
#if 0
class TransformKernelHelper
{
GPUTransformTypeEnum m_TransformType;
std::string m_TransformTypeAsString;
std::: size_t m_TransformKernelHandle;
bool m_Compiled;
TransformKernelHelper()
{
m_TransformType = GPUResampleImageFilter::Else;
m_TransformTypeAsString = "Else";
m_TransformKernelHandle = 0; // ??
m_Compiled = false;
}
};
std::vector< TransformKernelHelper > m_SupportedTransformKernels{};
#endif
std::vector<std::string> m_Sources{};
std::size_t m_SourceIndex{};
std::size_t m_InterpolatorSourceLoadedIndex{};
std::size_t m_TransformSourceLoadedIndex{};
bool m_InterpolatorIsBSpline{};
bool m_TransformIsCombo{};
std::size_t m_FilterPreGPUKernelHandle{};
TransformsHandle m_FilterLoopGPUKernelHandle{};
std::size_t m_FilterPostGPUKernelHandle{};
// GPU kernel managers
GPUKernelManagerPointer m_PreKernelManager{};
GPUKernelManagerPointer m_LoopKernelManager{};
GPUKernelManagerPointer m_PostKernelManager{};
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkGPUResampleImageFilter.hxx"
#endif
#endif /* itkGPUResampleImageFilter_h */
float
itk::GPUBSplineBaseTransform
GPU base class for the BSplineTransform.
Definition itkGPUBSplineBaseTransform.h:43
itk::GPUBSplineInterpolateImageFunction
GPU version of BSplineInterpolateImageFunction.
Definition itkGPUBSplineInterpolateImageFunction.h:49
itk::GPUBSplineInterpolateImageFunction< InputImageType, InterpolatorPrecisionType >::GPUCoefficientImageType
GPUImage< float, InputImageDimension > GPUCoefficientImageType
Definition itkGPUBSplineInterpolateImageFunction.h:76
itk::GPUBSplineInterpolateImageFunction< InputImageType, InterpolatorPrecisionType >::GPUCoefficientImagePointer
typename GPUCoefficientImageType::Pointer GPUCoefficientImagePointer
Definition itkGPUBSplineInterpolateImageFunction.h:77
itk::GPUBSplineInterpolateImageFunction< InputImageType, InterpolatorPrecisionType >::GPUDataManagerPointer
typename GPUDataManager::Pointer GPUDataManagerPointer
Definition itkGPUBSplineInterpolateImageFunction.h:78
itk::GPUCompositeTransformBase
Definition itkGPUCompositeTransformBase.h:39
itk::GPUDataManager::Pointer
SmartPointer< Self > Pointer
Definition itkGPUDataManager.h:74
itk::GPUImageToImageFilter< TInputImage, TOutputImage, ResampleImageFilter< TInputImage, TOutputImage, float, float > >::GPUImageToImageFilter
GPUImageToImageFilter()
itk::GPUInterpolatorBase
Base class fro all GPU interpolators.
Definition itkGPUInterpolatorBase.h:37
itk::GPUResampleImageFilter::GetGPUBSplineBaseTransform
GPUBSplineBaseTransformType * GetGPUBSplineBaseTransform(const std::vcl_size_t transformIndex)
itk::GPUResampleImageFilter::GPUTransformTypeEnum
GPUTransformTypeEnum
Definition itkGPUResampleImageFilter.h:137
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::IdentityTransform
@ IdentityTransform
Definition itkGPUResampleImageFilter.h:138
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::Else
@ Else
Definition itkGPUResampleImageFilter.h:142
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::MatrixOffsetTransform
@ MatrixOffsetTransform
Definition itkGPUResampleImageFilter.h:139
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::BSplineTransform
@ BSplineTransform
Definition itkGPUResampleImageFilter.h:141
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::TranslationTransform
@ TranslationTransform
Definition itkGPUResampleImageFilter.h:140
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_InterpolatorBase
GPUInterpolatorBase * m_InterpolatorBase
Definition itkGPUResampleImageFilter.h:188
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_TransformBase
GPUTransformBase * m_TransformBase
Definition itkGPUResampleImageFilter.h:189
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_FilterPostGPUKernelHandle
std::vcl_size_t m_FilterPostGPUKernelHandle
Definition itkGPUResampleImageFilter.h:232
itk::GPUResampleImageFilter::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkGPUResampleImageFilter.h:65
itk::GPUResampleImageFilter::~GPUResampleImageFilter
~GPUResampleImageFilter() override=default
itk::GPUResampleImageFilter::InterpolatorPrecisionType
TInterpolatorPrecisionType InterpolatorPrecisionType
Definition itkGPUResampleImageFilter.h:82
itk::GPUResampleImageFilter::HasTransform
bool HasTransform(const GPUTransformTypeEnum type) const
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_LoopKernelManager
GPUKernelManagerPointer m_LoopKernelManager
Definition itkGPUResampleImageFilter.h:236
itk::GPUResampleImageFilter::GPUResampleImageFilter
GPUResampleImageFilter()
itk::GPUResampleImageFilter::TransformHandle
std::pair< int, bool > TransformHandle
Definition itkGPUResampleImageFilter.h:197
itk::GPUResampleImageFilter::GPUDataManagerPointer
typename GPUDataManager::Pointer GPUDataManagerPointer
Definition itkGPUResampleImageFilter.h:97
itk::GPUResampleImageFilter::InputImageType
TInputImage InputImageType
Definition itkGPUResampleImageFilter.h:78
itk::GPUResampleImageFilter::GetTransformType
const GPUTransformTypeEnum GetTransformType(const int &transformIndex) const
itk::GPUResampleImageFilter::GPUOutputImage
typename GPUTraits< TOutputImage >::Type GPUOutputImage
Definition itkGPUResampleImageFilter.h:81
itk::GPUResampleImageFilter::GPUGenerateData
void GPUGenerateData() override
itk::GPUResampleImageFilter::GetKernelIdFromTransformId
bool GetKernelIdFromTransformId(const std::vcl_size_t &index, std::vcl_size_t &kernelId) const
itk::GPUResampleImageFilter::GPUBSplineInterpolatorDataManagerPointer
typename GPUBSplineInterpolatorType::GPUDataManagerPointer GPUBSplineInterpolatorDataManagerPointer
Definition itkGPUResampleImageFilter.h:104
itk::GPUResampleImageFilter::SetBSplineTransformCoefficientsToGPU
void SetBSplineTransformCoefficientsToGPU(const std::vcl_size_t transformIndex)
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_InputGPUImageBase
GPUDataManagerPointer m_InputGPUImageBase
Definition itkGPUResampleImageFilter.h:191
itk::GPUResampleImageFilter::GPUBSplineBaseTransformType
GPUBSplineBaseTransform< InterpolatorPrecisionType, InputImageDimension > GPUBSplineBaseTransformType
Definition itkGPUResampleImageFilter.h:107
itk::GPUResampleImageFilter::GPUSuperclass
GPUImageToImageFilter< TInputImage, TOutputImage, CPUSuperclass > GPUSuperclass
Definition itkGPUResampleImageFilter.h:63
itk::GPUResampleImageFilter::Pointer
SmartPointer< Self > Pointer
Definition itkGPUResampleImageFilter.h:64
itk::GPUResampleImageFilter::SetExtrapolator
void SetExtrapolator(ExtrapolatorType *_arg) override
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_PostKernelManager
GPUKernelManagerPointer m_PostKernelManager
Definition itkGPUResampleImageFilter.h:237
itk::GPUResampleImageFilter::SetArgumentsForLoopKernelManager
void SetArgumentsForLoopKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
itk::GPUResampleImageFilter::OutputImagePixelType
typename GPUSuperclass::OutputImagePixelType OutputImagePixelType
Definition itkGPUResampleImageFilter.h:93
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_DeformationFieldBuffer
GPUDataManagerPointer m_DeformationFieldBuffer
Definition itkGPUResampleImageFilter.h:194
itk::GPUResampleImageFilter::SetArgumentsForPreKernelManager
void SetArgumentsForPreKernelManager(const typename GPUOutputImage::Pointer &output)
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_PreKernelManager
GPUKernelManagerPointer m_PreKernelManager
Definition itkGPUResampleImageFilter.h:235
itk::GPUResampleImageFilter::GetTransformHandle
int GetTransformHandle(const GPUTransformTypeEnum type) const
itk::GPUResampleImageFilter::TransformsHandle
std::map< GPUTransformTypeEnum, TransformHandle > TransformsHandle
Definition itkGPUResampleImageFilter.h:198
itk::GPUResampleImageFilter::Self
GPUResampleImageFilter Self
Definition itkGPUResampleImageFilter.h:60
itk::GPUResampleImageFilter::SetTransformParametersForLoopKernelManager
void SetTransformParametersForLoopKernelManager(const std::vcl_size_t transformIndex)
itk::GPUResampleImageFilter::InputImageRegionType
typename CPUSuperclass::InputImageRegionType InputImageRegionType
Definition itkGPUResampleImageFilter.h:88
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_SourceIndex
std::vcl_size_t m_SourceIndex
Definition itkGPUResampleImageFilter.h:222
itk::GPUResampleImageFilter::SetTransform
void SetTransform(const TransformType *_arg) override
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_Sources
std::vector< std::string > m_Sources
Definition itkGPUResampleImageFilter.h:221
itk::GPUResampleImageFilter::itkStaticConstMacro
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension)
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_InterpolatorIsBSpline
bool m_InterpolatorIsBSpline
Definition itkGPUResampleImageFilter.h:227
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_TransformSourceLoadedIndex
std::vcl_size_t m_TransformSourceLoadedIndex
Definition itkGPUResampleImageFilter.h:225
itk::GPUResampleImageFilter::itkStaticConstMacro
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
itk::GPUResampleImageFilter::CompositeTransformBaseType
GPUCompositeTransformBase< InterpolatorPrecisionType, InputImageDimension > CompositeTransformBaseType
Definition itkGPUResampleImageFilter.h:98
itk::GPUResampleImageFilter::GPUKernelManagerPointer
typename OpenCLKernelManager::Pointer GPUKernelManagerPointer
Definition itkGPUResampleImageFilter.h:96
itk::GPUResampleImageFilter::OutputImageRegionType
typename CPUSuperclass::OutputImageRegionType OutputImageRegionType
Definition itkGPUResampleImageFilter.h:89
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_FilterLoopGPUKernelHandle
TransformsHandle m_FilterLoopGPUKernelHandle
Definition itkGPUResampleImageFilter.h:231
itk::GPUResampleImageFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::GPUResampleImageFilter::SetInterpolator
void SetInterpolator(InterpolatorType *_arg) override
itk::GPUResampleImageFilter::GPUBSplineInterpolatorCoefficientImagePointer
typename GPUBSplineInterpolatorType::GPUCoefficientImagePointer GPUBSplineInterpolatorCoefficientImagePointer
Definition itkGPUResampleImageFilter.h:103
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_InterpolatorSourceLoadedIndex
std::vcl_size_t m_InterpolatorSourceLoadedIndex
Definition itkGPUResampleImageFilter.h:224
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_FilterPreGPUKernelHandle
std::vcl_size_t m_FilterPreGPUKernelHandle
Definition itkGPUResampleImageFilter.h:230
itk::GPUResampleImageFilter::IndexType
typename CPUSuperclass::IndexType IndexType
Definition itkGPUResampleImageFilter.h:91
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_FilterParameters
GPUDataManagerPointer m_FilterParameters
Definition itkGPUResampleImageFilter.h:193
itk::GPUResampleImageFilter::SetArgumentsForPostKernelManager
void SetArgumentsForPostKernelManager(const typename GPUInputImage::Pointer &input, const typename GPUOutputImage::Pointer &output)
itk::GPUResampleImageFilter::GPUBSplineInterpolatorCoefficientImageType
typename GPUBSplineInterpolatorType::GPUCoefficientImageType GPUBSplineInterpolatorCoefficientImageType
Definition itkGPUResampleImageFilter.h:102
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_TransformIsCombo
bool m_TransformIsCombo
Definition itkGPUResampleImageFilter.h:228
itk::GPUResampleImageFilter::GPUBSplineInterpolatorType
GPUBSplineInterpolateImageFunction< InputImageType, InterpolatorPrecisionType > GPUBSplineInterpolatorType
Definition itkGPUResampleImageFilter.h:101
itk::GPUResampleImageFilter::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(GPUResampleImageFilter)
itk::GPUResampleImageFilter::InterpolatorType
typename CPUSuperclass::InterpolatorType InterpolatorType
Definition itkGPUResampleImageFilter.h:85
itk::GPUResampleImageFilter::SizeType
typename CPUSuperclass::SizeType SizeType
Definition itkGPUResampleImageFilter.h:90
itk::GPUResampleImageFilter::TransformType
typename CPUSuperclass::TransformType TransformType
Definition itkGPUResampleImageFilter.h:86
itk::GPUResampleImageFilter::OutputImageType
TOutputImage OutputImageType
Definition itkGPUResampleImageFilter.h:79
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_RequestedNumberOfSplits
unsigned int m_RequestedNumberOfSplits
Definition itkGPUResampleImageFilter.h:195
itk::GPUResampleImageFilter::ExtrapolatorType
typename CPUSuperclass::ExtrapolatorType ExtrapolatorType
Definition itkGPUResampleImageFilter.h:87
itk::GPUResampleImageFilter::CPUSuperclass
ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType > CPUSuperclass
Definition itkGPUResampleImageFilter.h:61
itk::GPUResampleImageFilter::GPUInputImage
typename GPUTraits< TInputImage >::Type GPUInputImage
Definition itkGPUResampleImageFilter.h:80
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::m_OutputGPUImageBase
GPUDataManagerPointer m_OutputGPUImageBase
Definition itkGPUResampleImageFilter.h:192
itk::GPUTransformBase
Base class for all GPU transforms.
Definition itkGPUTransformBase.h:37
itk::OpenCLKernelManager::Pointer
SmartPointer< Self > Pointer
Definition itkOpenCLKernelManager.h:75
itkGPUBSplineBaseTransform.h
itkGPUBSplineInterpolateImageFunction.h
itkGPUCompositeTransformBase.h
itkGPUImageToImageFilter.h
itkGPUInterpolateImageFunction.h
itkGPUTransformBase.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::itkGPUKernelClassMacro
itkGPUKernelClassMacro(GPUBSplineTransformKernel)

Generated on 1768596610 for elastix by 1.15.0 |