Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __itkCUDAResamplerImageFilter_h
00015 #define __itkCUDAResamplerImageFilter_h
00016
00017 #include "itkImage.h"
00018 #include "itkResampleImageFilter.h"
00019 #include "itkAdvancedCombinationTransform.h"
00020 #include "itkAdvancedBSplineDeformableTransform.h"
00021 #include "itkBSplineDeformableTransform.h"
00022 #include "cudaResampleImageFilter.cuh"
00023
00024 namespace itk
00025 {
00026
00039 template <typename TInputImage, typename TOutputImage, typename TInterpolatorPrecisionType = float>
00040 class ITK_EXPORT itkCUDAResampleImageFilter:
00041 public ResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType>
00042 {
00043 public:
00045 typedef itkCUDAResampleImageFilter Self;
00046 typedef ResampleImageFilter<
00047 TInputImage,TOutputImage,TInterpolatorPrecisionType> Superclass;
00048 typedef SmartPointer<Self> Pointer;
00049 typedef SmartPointer<const Self> ConstPointer;
00050
00052 itkNewMacro( Self );
00053
00055 itkTypeMacro( itkCUDAResampleImageFilter, ResampleImageFilter );
00056
00058 typedef typename Superclass::InputImageType InputImageType;
00059 typedef typename Superclass::OutputImageType OutputImageType;
00060 typedef typename Superclass::InputImagePointer InputImagePointer;
00061 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00062 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00063 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00064
00065 typedef typename Superclass::TransformType TransformType;
00066 typedef typename Superclass::TransformPointerType TransformPointerType;
00067 typedef typename Superclass::InterpolatorType InterpolatorType;
00068 typedef typename Superclass::InterpolatorPointerType InterpolatorPointerType;
00069
00070 typedef typename Superclass::SizeType SizeType;
00071 typedef typename Superclass::IndexType IndexType;
00072 typedef typename Superclass::PointType PointType;
00073 typedef typename Superclass::PixelType PixelType;
00074 typedef typename Superclass::InputPixelType InputPixelType;
00075 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00076 typedef typename Superclass::SpacingType SpacingType;
00077 typedef typename Superclass::OriginPointType OriginPointType;
00078 typedef typename Superclass::DirectionType DirectionType;
00079 typedef typename Superclass::ImageBaseType ImageBaseType;
00080
00082 typedef AdvancedCombinationTransform<
00083 TInterpolatorPrecisionType, 3 > InternalComboTransformType;
00084 typedef AdvancedBSplineDeformableTransform<
00085 TInterpolatorPrecisionType, 3, 3 > InternalAdvancedBSplineTransformType;
00086 typedef typename InternalAdvancedBSplineTransformType::Pointer ValidTransformPointer;
00087 typedef typename InternalAdvancedBSplineTransformType::ConstPointer ValidTransformConstPointer;
00088 typedef BSplineDeformableTransform<
00089 TInterpolatorPrecisionType, 3, 3 > InternalBSplineTransformType;
00090 typedef cuda::CUDAResampleImageFilter<
00091 typename InternalBSplineTransformType::ParametersValueType,
00092 typename TInputImage::PixelType, float > CudaResampleImageFilterType;
00093
00095 itkSetMacro( UseCuda, bool );
00096 itkGetConstMacro( UseCuda, bool );
00097 itkBooleanMacro( UseCuda );
00098
00100 itkSetMacro( UseGPUToCastData, bool );
00101 itkGetConstMacro( UseGPUToCastData, bool );
00102 itkBooleanMacro( UseGPUToCastData );
00103
00105 itkSetMacro( UseFastCUDAKernel, bool );
00106 itkGetConstMacro( UseFastCUDAKernel, bool );
00107 itkBooleanMacro( UseFastCUDAKernel );
00108
00110 virtual void GenerateData( void );
00111
00113 class WarningReportType
00114 {
00115 public:
00116 std::vector<std::string> m_Warnings;
00117
00118 void ResetWarningReport( void )
00119 {
00120 this->m_Warnings.resize( 0 );
00121 }
00122 std::string GetWarningReportAsString( void ) const
00123 {
00124 std::string warnings = "\n---------------------------------\n";
00125 for ( std::size_t i = 0; i < this->m_Warnings.size(); i++ )
00126 {
00127 warnings += "itkCUDAResampleImageFilter: " + this->m_Warnings[ i ];
00128 warnings += "\n---------------------------------\n";
00129 }
00130 return warnings;
00131 }
00132 };
00133
00134 virtual const WarningReportType & GetWarningReport( void ) const
00135 {
00136 return this->m_WarningReport;
00137 }
00138
00139 protected:
00140 itkCUDAResampleImageFilter();
00141 ~itkCUDAResampleImageFilter();
00142
00143 virtual void CheckForValidConfiguration( ValidTransformPointer & bSplineTransform );
00144
00145 private:
00146
00148 bool m_UseCuda;
00149 bool m_UseGPUToCastData;
00150 bool m_UseFastCUDAKernel;
00151
00152 CudaResampleImageFilterType m_CudaResampleImageFilter;
00153 WarningReportType m_WarningReport;
00154
00159 bool CheckForValidTransform( ValidTransformPointer & bSplineTransform ) const;
00160
00164 bool CheckForValidInterpolator( void ) const;
00165
00169 bool CheckForValidDirectionCosines( ValidTransformPointer bSplineTransform ) ;
00170
00171
00173 void CopyParameters( ValidTransformPointer bSplineTransform );
00174
00175 };
00176
00177 };
00178
00179 #ifndef ITK_MANUAL_INSTANTIATION
00180 #include "itkCUDAResampleImageFilter.hxx"
00181 #endif
00182
00183 #endif // end #ifndef __itkCUDAResamplerImageFilter_h