ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkGPUImageDataManager.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 
19 #ifndef __itkGPUImageDataManager_h
20 #define __itkGPUImageDataManager_h
21 
22 #include <itkObject.h>
23 #include <itkTimeStamp.h>
24 #include <itkLightObject.h>
25 #include <itkObjectFactory.h>
26 #include "itkOpenCLUtil.h"
27 #include "itkGPUDataManager.h"
28 #include "itkGPUContextManager.h"
29 #include "itkSimpleFastMutexLock.h"
30 
31 namespace itk
32 {
33 template < class TPixel, unsigned int NDimension > class GPUImage;
34 
43 template < class ImageType >
44 class ITK_EXPORT GPUImageDataManager : public GPUDataManager
45 {
46  // allow GPUKernelManager to access GPU buffer pointer
47  friend class GPUKernelManager;
48  friend class GPUImage< typename ImageType::PixelType, ImageType::ImageDimension >;
49 
50 public:
53  typedef SmartPointer<Self> Pointer;
54  typedef SmartPointer<const Self> ConstPointer;
55 
56  itkNewMacro(Self);
57  itkTypeMacro(GPUImageDataManager, GPUDataManager);
58 
59  void SetImagePointer( typename ImageType::Pointer img );
60 
62  virtual void MakeCPUBufferUpToDate();
63 
65  virtual void MakeGPUBufferUpToDate();
66 
68  virtual void Graft(const GPUDataManager* data);
69 
70 protected:
72  virtual ~GPUImageDataManager() {}
73 
74 private:
75  GPUImageDataManager(const Self&); //purposely not implemented
76  void operator=(const Self&);
77 
78  typename ImageType::Pointer m_Image;
79 };
80 
81 } // namespace itk
82 
83 #if ITK_TEMPLATE_TXX
84 #include "itkGPUImageDataManager.hxx"
85 #endif
86 
87 #endif
88