ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkGPUFiniteDifferenceFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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  * http://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 #ifndef __itkGPUFiniteDifferenceFunction_h
19 #define __itkGPUFiniteDifferenceFunction_h
20 
22 #include "itkLightObject.h"
24 #include "itkVector.h"
25 
26 #include "itkGPUDataManager.h"
27 #include "itkGPUKernelManager.h"
28 
29 namespace itk
30 {
46 template< class TImageType >
47 class ITK_EXPORT GPUFiniteDifferenceFunction : public FiniteDifferenceFunction< TImageType >
48 {
49 public:
50 
57 
60 
62  typedef typename Superclass::ImageType ImageType;
63  typedef typename Superclass::PixelType PixelType;
64  typedef typename Superclass::PixelRealType PixelRealType;
65 
67  itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
68 
70  typedef typename Superclass::TimeStepType TimeStepType;
71 
74  typedef typename Superclass::DefaultBoundaryConditionType DefaultBoundaryConditionType;
75 
77  typedef typename Superclass::RadiusType RadiusType;
78 
80  typedef typename Superclass::NeighborhoodType NeighborhoodType;
81 
84  typedef typename Superclass::FloatOffsetType FloatOffsetType;
85 
86  virtual void InitializeIteration() {}
87 
88 #if !defined( CABLE_CONFIGURATION )
89 
90  virtual PixelType ComputeUpdate( const NeighborhoodType & itkNotUsed(neighborhood),
91  void *itkNotUsed(globalData),
92  const FloatOffsetType & itkNotUsed(offset = FloatOffsetType(0.0)) )
93  {
95  return pix;
96  }
97 #endif
98 
99 
101  virtual void GPUComputeUpdate( const typename TImageType::Pointer output,
102  typename TImageType::Pointer update,
103  void *gd) = 0;
104 
107  virtual void GPUAllocateMetricData(unsigned int itkNotUsed(numPixels)) {}
108 
111  virtual void GPUReleaseMetricData() {}
112 
113 protected:
115  m_GPUKernelManager = GPUKernelManager::New();
116  }
118  }
119 
120  void PrintSelf(std::ostream & os, Indent indent) const
121  {
122  Superclass::PrintSelf(os, indent);
123  }
124 
127 
130 
131 private:
132  GPUFiniteDifferenceFunction(const Self &); //purposely not implemented
133  void operator=(const Self &); //purposely not implemented
134 
135 };
136 } // end namespace itk
137 
138 #endif
139