Loading...
Searching...
No Matches
elxOpenCLResampler.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 elxOpenCLResampler_h
#define elxOpenCLResampler_h
#include "elxIncludes.h" // include first to avoid MSVS warning
#include "elxOpenCLSupportedImageTypes.h"
#include "itkGPUResampleImageFilter.h"
#include "itkGPUAdvancedCombinationTransformCopier.h"
#include "itkGPUInterpolatorCopier.h"
namespace elastix
{
template <class TElastix>
class OpenCLResampler
: public itk::ResampleImageFilter<typename ResamplerBase<TElastix>::InputImageType,
typename ResamplerBase<TElastix>::OutputImageType,
typename ResamplerBase<TElastix>::CoordRepType>
, public ResamplerBase<TElastix>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(OpenCLResampler);
using Self = OpenCLResampler;
using Superclass1 = itk::ResampleImageFilter<typename ResamplerBase<TElastix>::InputImageType,
typename ResamplerBase<TElastix>::OutputImageType,
typename ResamplerBase<TElastix>::CoordRepType>;
using Superclass2 = ResamplerBase<TElastix>;
using Pointer = itk::SmartPointer<Self>;
using ConstPointer = itk::SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(OpenCLResampler, ResampleImageFilter);
elxClassNameMacro("OpenCLResampler");
using typename Superclass1::InterpolatorType;
using typename Superclass1::TransformType;
using typename Superclass1::InputImageType;
using InputImagePixelType = typename InputImageType::PixelType;
using typename Superclass1::OutputImageType;
using OutputImagePixelType = typename OutputImageType::PixelType;
using OutputImageRegionType = typename OutputImageType::RegionType;
using GPUInputImageType = itk::GPUImage<InputImagePixelType, InputImageType::ImageDimension>;
using GPUInputImagePointer = typename GPUInputImageType::Pointer;
using GPUOutputImageType = itk::GPUImage<OutputImagePixelType, OutputImageType::ImageDimension>;
using GPUInterpolatorPrecisionType = float;
using GPUResamplerType =
itk::GPUResampleImageFilter<GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType>;
using GPUResamplerPointer = typename GPUResamplerType::Pointer;
using typename Superclass2::ParameterMapType;
void
SetTransform(const TransformType * _arg) override;
void
SetInterpolator(InterpolatorType * _arg) override;
void
BeforeRegistration() override;
void
ReadFromFile() override;
protected:
OpenCLResampler();
~OpenCLResampler() override = default;
void
BeforeGenerateData();
void
GenerateData() override;
using InterpolatorPrecisionType = typename ResamplerBase<TElastix>::CoordRepType;
using AdvancedCombinationTransformType =
typename itk::AdvancedCombinationTransform<InterpolatorPrecisionType, OutputImageType::ImageDimension>;
using TransformCopierType = typename itk::GPUAdvancedCombinationTransformCopier<OpenCLImageTypes,
OpenCLImageDimentions,
AdvancedCombinationTransformType,
float>;
using TransformCopierPointer = typename TransformCopierType::Pointer;
using GPUTransformPointer = typename TransformCopierType::GPUComboTransformPointer;
using InterpolatorInputImageType = typename InterpolatorType::InputImageType;
using InterpolatorCoordRepType = typename InterpolatorType::CoordRepType;
using InterpolateImageFunctionType =
itk::InterpolateImageFunction<InterpolatorInputImageType, InterpolatorCoordRepType>;
using InterpolateCopierType =
typename itk::GPUInterpolatorCopier<OpenCLImageTypes, OpenCLImageDimentions, InterpolateImageFunctionType, float>;
using InterpolateCopierPointer = typename InterpolateCopierType::Pointer;
using GPUExplicitInterpolatorPointer = typename InterpolateCopierType::GPUExplicitInterpolatorPointer;
private:
elxOverrideGetSelfMacro;
ParameterMapType
CreateDerivedTransformParameterMap() const override;
void
SwitchingToCPUAndReport(const bool configError);
void
ReportToLog();
TransformCopierPointer m_TransformCopier;
InterpolateCopierPointer m_InterpolatorCopier;
GPUResamplerPointer m_GPUResampler;
bool m_GPUResamplerReady;
bool m_GPUResamplerCreated;
bool m_ContextCreated;
bool m_UseOpenCL;
};
// end class OpenCLResampler
} // end namespace elastix
#ifndef ITK_MANUAL_INSTANTIATION
# include "elxOpenCLResampler.hxx"
#endif
#endif // end #ifndef elxOpenCLResampler_h
elastix::OpenCLResampler::GenerateData
void GenerateData() override
elastix::OpenCLResampler::ReportToLog
void ReportToLog()
elastix::OpenCLResampler::TransformCopierType
typename itk::GPUAdvancedCombinationTransformCopier< OpenCLImageTypes, OpenCLImageDimentions, AdvancedCombinationTransformType, float > TransformCopierType
Definition elxOpenCLResampler.h:138
elastix::OpenCLResampler::GPUResamplerPointer
typename GPUResamplerType::Pointer GPUResamplerPointer
Definition elxOpenCLResampler.h:100
elastix::OpenCLResampler::InterpolatorCoordRepType
typename InterpolatorType::CoordRepType InterpolatorCoordRepType
Definition elxOpenCLResampler.h:147
elastix::OpenCLResampler::m_GPUResamplerCreated
bool m_GPUResamplerCreated
Definition elxOpenCLResampler.h:174
elastix::OpenCLResampler::GPUOutputImageType
itk::GPUImage< OutputImagePixelType, OutputImageType::ImageDimension > GPUOutputImageType
Definition elxOpenCLResampler.h:95
elastix::OpenCLResampler::GPUTransformPointer
typename TransformCopierType::GPUComboTransformPointer GPUTransformPointer
Definition elxOpenCLResampler.h:143
elastix::OpenCLResampler::GPUExplicitInterpolatorPointer
typename InterpolateCopierType::GPUExplicitInterpolatorPointer GPUExplicitInterpolatorPointer
Definition elxOpenCLResampler.h:153
elastix::OpenCLResampler::CreateDerivedTransformParameterMap
ParameterMapType CreateDerivedTransformParameterMap() const override
elastix::OpenCLResampler::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(OpenCLResampler)
elastix::OpenCLResampler::TransformCopierPointer
typename TransformCopierType::Pointer TransformCopierPointer
Definition elxOpenCLResampler.h:142
elastix::OpenCLResampler::GPUResamplerType
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType > GPUResamplerType
Definition elxOpenCLResampler.h:98
elastix::OpenCLResampler::BeforeGenerateData
void BeforeGenerateData()
elastix::OpenCLResampler::GPUInputImageType
itk::GPUImage< InputImagePixelType, InputImageType::ImageDimension > GPUInputImageType
Definition elxOpenCLResampler.h:93
elastix::OpenCLResampler::ParameterMapType
typename ElastixType::ParameterMapType ParameterMapType
Definition elxResamplerBase.h:114
elastix::OpenCLResampler::InterpolateCopierType
typename itk::GPUInterpolatorCopier< OpenCLImageTypes, OpenCLImageDimentions, InterpolateImageFunctionType, float > InterpolateCopierType
Definition elxOpenCLResampler.h:150
elastix::OpenCLResampler::m_TransformCopier
TransformCopierPointer m_TransformCopier
Definition elxOpenCLResampler.h:170
elastix::OpenCLResampler::GPUInterpolatorPrecisionType
float GPUInterpolatorPrecisionType
Definition elxOpenCLResampler.h:96
elastix::OpenCLResampler::SwitchingToCPUAndReport
void SwitchingToCPUAndReport(const bool configError)
elastix::OpenCLResampler::OpenCLResampler
OpenCLResampler()
elastix::OpenCLResampler::InterpolateImageFunctionType
itk::InterpolateImageFunction< InterpolatorInputImageType, InterpolatorCoordRepType > InterpolateImageFunctionType
Definition elxOpenCLResampler.h:148
elastix::OpenCLResampler::~OpenCLResampler
~OpenCLResampler() override=default
elastix::OpenCLResampler::Superclass1
itk::ResampleImageFilter< typename ResamplerBase< TElastix >::InputImageType, typename ResamplerBase< TElastix >::OutputImageType, typename ResamplerBase< TElastix >::CoordRepType > Superclass1
Definition elxOpenCLResampler.h:62
elastix::OpenCLResampler::elxClassNameMacro
elxClassNameMacro("OpenCLResampler")
elastix::OpenCLResampler::GPUInputImagePointer
typename GPUInputImageType::Pointer GPUInputImagePointer
Definition elxOpenCLResampler.h:94
elastix::OpenCLResampler::Pointer
itk::SmartPointer< Self > Pointer
Definition elxOpenCLResampler.h:66
elastix::OpenCLResampler::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition elxOpenCLResampler.h:67
elastix::OpenCLResampler::ReadFromFile
void ReadFromFile() override
elastix::OpenCLResampler::Superclass2
ResamplerBase< TElastix > Superclass2
Definition elxOpenCLResampler.h:65
elastix::OpenCLResampler::SetInterpolator
void SetInterpolator(InterpolatorType *_arg) override
elastix::OpenCLResampler::m_GPUResampler
GPUResamplerPointer m_GPUResampler
Definition elxOpenCLResampler.h:172
elastix::OpenCLResampler::elxOverrideGetSelfMacro
elxOverrideGetSelfMacro
Definition elxOpenCLResampler.h:156
elastix::OpenCLResampler::m_ContextCreated
bool m_ContextCreated
Definition elxOpenCLResampler.h:175
elastix::OpenCLResampler::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition elxOpenCLResampler.h:86
elastix::OpenCLResampler::SetTransform
void SetTransform(const TransformType *_arg) override
elastix::OpenCLResampler::m_UseOpenCL
bool m_UseOpenCL
Definition elxOpenCLResampler.h:176
elastix::OpenCLResampler::Self
OpenCLResampler Self
Definition elxOpenCLResampler.h:60
elastix::OpenCLResampler::m_GPUResamplerReady
bool m_GPUResamplerReady
Definition elxOpenCLResampler.h:173
elastix::OpenCLResampler::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition elxOpenCLResampler.h:90
elastix::OpenCLResampler::InterpolateCopierPointer
typename InterpolateCopierType::Pointer InterpolateCopierPointer
Definition elxOpenCLResampler.h:152
elastix::OpenCLResampler::InterpolatorInputImageType
typename InterpolatorType::InputImageType InterpolatorInputImageType
Definition elxOpenCLResampler.h:146
elastix::OpenCLResampler::InterpolatorPrecisionType
typename ResamplerBase< TElastix >::CoordRepType InterpolatorPrecisionType
Definition elxOpenCLResampler.h:135
elastix::OpenCLResampler::AdvancedCombinationTransformType
typename itk::AdvancedCombinationTransform< InterpolatorPrecisionType, OutputImageType::ImageDimension > AdvancedCombinationTransformType
Definition elxOpenCLResampler.h:136
elastix::OpenCLResampler::BeforeRegistration
void BeforeRegistration() override
elastix::OpenCLResampler::m_InterpolatorCopier
InterpolateCopierPointer m_InterpolatorCopier
Definition elxOpenCLResampler.h:171
elastix::OpenCLResampler::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition elxOpenCLResampler.h:89
elastix::ResamplerBase::OutputImageType
typename ElastixType::MovingImageType OutputImageType
Definition elxResamplerBase.h:96
elastix::ResamplerBase::ParameterMapType
typename ElastixType::ParameterMapType ParameterMapType
Definition elxResamplerBase.h:114
elastix::ResamplerBase::ResamplerBase
ResamplerBase()=default
elastix::ResamplerBase::TransformType
typename ITKBaseType::TransformType TransformType
Definition elxResamplerBase.h:104
elastix::ResamplerBase::CoordRepType
ElastixBase::CoordRepType CoordRepType
Definition elxResamplerBase.h:98
elastix::ResamplerBase::InterpolatorType
typename ITKBaseType::InterpolatorType InterpolatorType
Definition elxResamplerBase.h:105
float
itk::AdvancedCombinationTransform
This class combines two transforms: an 'initial transform' with a 'current transform'.
Definition itkAdvancedCombinationTransform.h:57
itk::GPUAdvancedCombinationTransformCopier
A helper class which creates an GPU AdvancedCombinationTransform which is perfect copy of the CPU Adv...
Definition itkGPUAdvancedCombinationTransformCopier.h:67
itk::GPUImage
Templated n-dimensional image class for the GPU.
Definition itkGPUImage.h:64
itk::GPUImage< InputImagePixelType, InputImageType::ImageDimension >::Pointer
SmartPointer< Self > Pointer
Definition itkGPUImage.h:70
itk::GPUInterpolatorCopier
A helper class which creates an GPU interpolator which is perfect copy of the CPU interpolator.
Definition itkGPUInterpolatorCopier.h:66
itk::GPUResampleImageFilter
GPU version of ResampleImageFilter.
Definition itkGPUResampleImageFilter.h:55
itk::GPUResampleImageFilter< GPUInputImageType, GPUOutputImageType, GPUInterpolatorPrecisionType >::Pointer
SmartPointer< Self > Pointer
Definition itkGPUResampleImageFilter.h:64
elxIncludes.h
itkGPUAdvancedCombinationTransformCopier.h
itkGPUInterpolatorCopier.h
itkGPUResampleImageFilter.h
elastix
Definition elxDefaultConstruct.h:25

Generated on 1768596610 for elastix by 1.15.0 |