NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkLightweightCUDAImage.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 
16 #ifndef niftkLightweightCUDAImage_h
17 #define niftkLightweightCUDAImage_h
18 
19 #include "niftkCUDAExports.h"
20 #include <cuda_runtime_api.h>
21 #include <QAtomicInt>
22 
23 namespace niftk
24 {
25 
26 // forward-decl
27 class CUDAManager;
28 
33 class NIFTKCUDA_EXPORT LightweightCUDAImage
34 {
35  friend class CUDAManager;
36 
37 public:
43 
48 
52  LightweightCUDAImage& operator=(const LightweightCUDAImage& assignme);
53 
54 
58  unsigned int GetId() const;
59 
60  unsigned int GetWidth() const;
61  unsigned int GetHeight() const;
62  unsigned int GetBytePitch() const;
63 
69  cudaEvent_t GetReadyEvent() const;
70 
71 
72 private:
73  QAtomicInt* m_RefCount;
74 
75  int m_Device; // the device this image lives on.
76  unsigned int m_Id;
77  cudaEvent_t m_ReadyEvent; // signaled when the image is ready for consumption.
78 
79  void* m_DevicePtr;
80  std::size_t m_SizeInBytes;
81 
82  unsigned int m_Width; // in pixel
83  unsigned int m_Height; // in (pixel) lines
84  unsigned int m_BytePitch; // length of a line of pixels in bytes.
85  int m_PixelType; // FIXME: not fully spec'd!
86 
87  // debugging
88  cudaStream_t m_LastUsedByStream;
89 };
90 
91 } // end namespace
92 
93 #endif
Definition: niftkCUDAManager.h:120
Definition: niftkLightweightCUDAImage.h:33
Definition: niftkExceptionObject.h:21