go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkCUDAResampleImageFilter.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __itkCUDAResamplerImageFilter_h
15 #define __itkCUDAResamplerImageFilter_h
16 
17 #include "itkImage.h"
18 #include "itkResampleImageFilter.h"
21 #include "itkBSplineDeformableTransform.h"
22 #include "cudaResampleImageFilter.cuh"
23 
24 namespace itk
25 {
26 
39 template< typename TInputImage, typename TOutputImage, typename TInterpolatorPrecisionType = float >
40 class ITK_EXPORT itkCUDAResampleImageFilter :
41  public ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType >
42 {
43 public:
44 
47  typedef ResampleImageFilter<
48  TInputImage, TOutputImage, TInterpolatorPrecisionType > Superclass;
49  typedef SmartPointer< Self > Pointer;
50  typedef SmartPointer< const Self > ConstPointer;
51 
53  itkNewMacro( Self );
54 
56  itkTypeMacro( itkCUDAResampleImageFilter, ResampleImageFilter );
57 
59  typedef typename Superclass::InputImageType InputImageType;
60  typedef typename Superclass::OutputImageType OutputImageType;
61  typedef typename Superclass::InputImagePointer InputImagePointer;
62  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
63  typedef typename Superclass::OutputImagePointer OutputImagePointer;
64  typedef typename Superclass::InputImageRegionType InputImageRegionType;
65 
66  typedef typename Superclass::TransformType TransformType;
67  typedef typename Superclass::TransformPointerType TransformPointerType;
68  typedef typename Superclass::InterpolatorType InterpolatorType;
69  typedef typename Superclass::InterpolatorPointerType InterpolatorPointerType;
70 
71  typedef typename Superclass::SizeType SizeType;
72  typedef typename Superclass::IndexType IndexType;
73  typedef typename Superclass::PointType PointType;
74  typedef typename Superclass::PixelType PixelType;
75  typedef typename Superclass::InputPixelType InputPixelType;
76  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
77  typedef typename Superclass::SpacingType SpacingType;
78  typedef typename Superclass::OriginPointType OriginPointType;
79  typedef typename Superclass::DirectionType DirectionType;
80  typedef typename Superclass::ImageBaseType ImageBaseType;
81 
84  TInterpolatorPrecisionType, 3 > InternalComboTransformType;
86  TInterpolatorPrecisionType, 3, 3 > InternalAdvancedBSplineTransformType;
89  typedef BSplineDeformableTransform<
90  TInterpolatorPrecisionType, 3, 3 > InternalBSplineTransformType;
91  typedef cuda::CUDAResampleImageFilter<
92  typename InternalBSplineTransformType::ParametersValueType,
93  typename TInputImage::PixelType, float > CudaResampleImageFilterType;
94 
96  itkSetMacro( UseCuda, bool );
97  itkGetConstMacro( UseCuda, bool );
98  itkBooleanMacro( UseCuda );
99 
101  itkSetMacro( UseGPUToCastData, bool );
102  itkGetConstMacro( UseGPUToCastData, bool );
103  itkBooleanMacro( UseGPUToCastData );
104 
106  itkSetMacro( UseFastCUDAKernel, bool );
107  itkGetConstMacro( UseFastCUDAKernel, bool );
108  itkBooleanMacro( UseFastCUDAKernel );
109 
111  virtual void GenerateData( void );
112 
115  {
116 public:
117 
118  std::vector< std::string > m_Warnings;
119 
120  void ResetWarningReport( void )
121  {
122  this->m_Warnings.resize( 0 );
123  }
124 
125 
126  std::string GetWarningReportAsString( void ) const
127  {
128  std::string warnings = "\n---------------------------------\n";
129  for( std::size_t i = 0; i < this->m_Warnings.size(); i++ )
130  {
131  warnings += "itkCUDAResampleImageFilter: " + this->m_Warnings[ i ];
132  warnings += "\n---------------------------------\n";
133  }
134  return warnings;
135  }
136 
137 
138  };
139 
140  //itkGetConstReferenceMacro( WarningReport, WarningReportType );
141  virtual const WarningReportType & GetWarningReport( void ) const
142  {
143  return this->m_WarningReport;
144  }
145 
146 
147 protected:
148 
151 
152  virtual void CheckForValidConfiguration( ValidTransformPointer & bSplineTransform );
153 
154 private:
155 
157  bool m_UseCuda;
160 
162  WarningReportType m_WarningReport;
163 
168  bool CheckForValidTransform( ValidTransformPointer & bSplineTransform ) const;
169 
173  bool CheckForValidInterpolator( void ) const;
174 
178  bool CheckForValidDirectionCosines( ValidTransformPointer bSplineTransform ); //const;
179 
180  // NOTE: const can be added again in ITK4. It's due to GetInput() being not const-correct.
181 
183  void CopyParameters( ValidTransformPointer bSplineTransform );
184 
185 };
186 
187 // end class itkCUDAResampleImageFilter
188 
189 } // end namespace itk
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 #include "itkCUDAResampleImageFilter.hxx"
193 #endif
194 
195 #endif // end #ifndef __itkCUDAResamplerImageFilter_h
This class combines two transforms: an 'initial transform' with a 'current transform'.
Superclass::OutputImageType OutputImageType
Superclass::TransformPointerType TransformPointerType
Deformable transform using a B-spline representation.
Superclass::InterpolatorPointerType InterpolatorPointerType
Resample an image on the GPU via a coordinate transform.
Superclass::InputImageRegionType InputImageRegionType
BSplineDeformableTransform< TInterpolatorPrecisionType, 3, 3 > InternalBSplineTransformType
Superclass::InputImagePointer InputImagePointer
virtual const WarningReportType & GetWarningReport(void) const
CudaResampleImageFilterType m_CudaResampleImageFilter
InternalAdvancedBSplineTransformType::ConstPointer ValidTransformConstPointer
AdvancedCombinationTransform< TInterpolatorPrecisionType, 3 > InternalComboTransformType
InternalAdvancedBSplineTransformType::Pointer ValidTransformPointer
Superclass::OutputImagePointer OutputImagePointer
Superclass::InputImageType InputImageType
Superclass::InputImageConstPointer InputImageConstPointer
Superclass::OriginPointType OriginPointType
Superclass::OutputImageRegionType OutputImageRegionType
SmartPointer< const Self > ConstPointer
Superclass::InputPixelType InputPixelType
AdvancedBSplineDeformableTransform< TInterpolatorPrecisionType, 3, 3 > InternalAdvancedBSplineTransformType
Superclass::InterpolatorType InterpolatorType
cuda::CUDAResampleImageFilter< typename InternalBSplineTransformType::ParametersValueType, typename TInputImage::PixelType, float > CudaResampleImageFilterType
ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType > Superclass


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo