go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
itk::GPUDataManager Class Reference

#include <itkGPUDataManager.h>

Detailed Description

GPU memory manager implemented using OpenCL. Required by GPUImage class.

This class serves as a base class for GPU data container for GPUImage class, which is similar to ImageBase class for Image class. However, all the image-related meta data will be already stored in image class (parent of GPUImage), therefore we did not name it GPUImageBase. Rather, this class is a GPU-specific data manager that provides functionalities for CPU-GPU data synchronization and grafting GPU data.

Note
This file was taken from ITK 4.1.0. It was modified by Denis P. Shamonin and Marius Staring. Division of Image Processing, Department of Radiology, Leiden, The Netherlands. Added functionality is described in the Insight Journal paper: http://hdl.handle.net/10380/3393

Definition at line 66 of file itkGPUDataManager.h.

Inheritance diagram for itk::GPUDataManager:
Inheritance graph
[legend]

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef MutexLockHolder< SimpleFastMutexLock > MutexHolderType
 
typedef SmartPointer< SelfPointer
 
typedef GPUDataManager Self
 
typedef Object Superclass
 

Public Member Functions

void Allocate ()
 
unsigned int GetBufferSize ()
 
virtual const char * GetClassName () const
 
virtual const boolGetCPUBufferLock ()
 
void * GetCPUBufferPointer ()
 
virtual const boolGetGPUBufferLock ()
 
cl_mem * GetGPUBufferPointer ()
 
virtual void Graft (const GPUDataManager *data)
 
virtual void Initialize ()
 
bool IsCPUBufferDirty ()
 
bool IsGPUBufferDirty ()
 
void SetBufferFlag (cl_mem_flags flags)
 
void SetBufferSize (unsigned int num)
 
void SetCPUBufferDirty ()
 
void SetCPUBufferLock (const bool v)
 
void SetCPUBufferPointer (void *ptr)
 
void SetCPUDirtyFlag (bool isDirty)
 
void SetGPUBufferDirty ()
 
void SetGPUBufferLock (const bool v)
 
void SetGPUDirtyFlag (bool isDirty)
 
bool Update ()
 
virtual void UpdateCPUBuffer ()
 
virtual void UpdateGPUBuffer ()
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 GPUDataManager ()
 
virtual void PrintSelf (std::ostream &os, Indent indent) const
 
virtual ~GPUDataManager ()
 

Protected Attributes

unsigned int m_BufferSize
 
OpenCLContextm_Context
 
void * m_CPUBuffer
 
bool m_CPUBufferLock
 
cl_mem m_GPUBuffer
 
bool m_GPUBufferLock
 
bool m_IsCPUBufferDirty
 
bool m_IsGPUBufferDirty
 
cl_mem_flags m_MemFlags
 
SimpleFastMutexLock m_Mutex
 

Private Member Functions

 GPUDataManager (const Self &)
 
void operator= (const Self &)
 

Friends

class OpenCLKernelManager
 

Member Typedef Documentation

typedef SmartPointer< const Self > itk::GPUDataManager::ConstPointer

Definition at line 76 of file itkGPUDataManager.h.

typedef MutexLockHolder< SimpleFastMutexLock > itk::GPUDataManager::MutexHolderType

Definition at line 82 of file itkGPUDataManager.h.

typedef SmartPointer< Self > itk::GPUDataManager::Pointer

Definition at line 75 of file itkGPUDataManager.h.

Definition at line 73 of file itkGPUDataManager.h.

Definition at line 74 of file itkGPUDataManager.h.

Constructor & Destructor Documentation

itk::GPUDataManager::GPUDataManager ( )
protected
virtual itk::GPUDataManager::~GPUDataManager ( )
protectedvirtual
itk::GPUDataManager::GPUDataManager ( const Self )
private

Member Function Documentation

void itk::GPUDataManager::Allocate ( )
unsigned int itk::GPUDataManager::GetBufferSize ( )
inline

Definition at line 89 of file itkGPUDataManager.h.

virtual const char* itk::GPUDataManager::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

virtual const bool& itk::GPUDataManager::GetCPUBufferLock ( )
virtual
void* itk::GPUDataManager::GetCPUBufferPointer ( )

Get GPU buffer pointer

virtual const bool& itk::GPUDataManager::GetGPUBufferLock ( )
virtual
cl_mem* itk::GPUDataManager::GetGPUBufferPointer ( )

Get GPU buffer pointer

virtual void itk::GPUDataManager::Graft ( const GPUDataManager data)
virtual

Method for grafting the content of one GPUDataManager into another one

virtual void itk::GPUDataManager::Initialize ( )
virtual

Initialize GPUDataManager

bool itk::GPUDataManager::IsCPUBufferDirty ( )
inline

Definition at line 111 of file itkGPUDataManager.h.

bool itk::GPUDataManager::IsGPUBufferDirty ( )
inline

Definition at line 117 of file itkGPUDataManager.h.

static Pointer itk::GPUDataManager::New ( )
static

Method for creation through the object factory.

void itk::GPUDataManager::operator= ( const Self )
private
virtual void itk::GPUDataManager::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual
void itk::GPUDataManager::SetBufferFlag ( cl_mem_flags  flags)
void itk::GPUDataManager::SetBufferSize ( unsigned int  num)

total buffer size in bytes

void itk::GPUDataManager::SetCPUBufferDirty ( )

Make GPU up-to-date and mark CPU as dirty. Call this function when you want to modify CPU data

void itk::GPUDataManager::SetCPUBufferLock ( const bool  v)
inline

Make CPU buffer locked to avoid extra update from ITK pipeline.

Definition at line 147 of file itkGPUDataManager.h.

void itk::GPUDataManager::SetCPUBufferPointer ( void *  ptr)
void itk::GPUDataManager::SetCPUDirtyFlag ( bool  isDirty)
void itk::GPUDataManager::SetGPUBufferDirty ( )

Make CPU up-to-date and mark GPU as dirty. Call this function when you want to modify GPU data

void itk::GPUDataManager::SetGPUBufferLock ( const bool  v)
inline

Make GPU buffer locked to avoid extra update from ITK pipeline.

Definition at line 151 of file itkGPUDataManager.h.

void itk::GPUDataManager::SetGPUDirtyFlag ( bool  isDirty)
bool itk::GPUDataManager::Update ( )

Synchronize CPU and GPU buffers (using dirty flags)

virtual void itk::GPUDataManager::UpdateCPUBuffer ( )
virtual

actual GPU->CPU memory copy takes place here

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

virtual void itk::GPUDataManager::UpdateGPUBuffer ( )
virtual

actual CPU->GPU memory copy takes place here

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

Friends And Related Function Documentation

friend class OpenCLKernelManager
friend

allow GPUKernelManager to access GPU buffer pointer

Definition at line 69 of file itkGPUDataManager.h.

Field Documentation

unsigned int itk::GPUDataManager::m_BufferSize
protected

Definition at line 167 of file itkGPUDataManager.h.

OpenCLContext* itk::GPUDataManager::m_Context
protected

Definition at line 169 of file itkGPUDataManager.h.

void* itk::GPUDataManager::m_CPUBuffer
protected

Definition at line 176 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_CPUBufferLock
protected

extra safety flags

Definition at line 183 of file itkGPUDataManager.h.

cl_mem itk::GPUDataManager::m_GPUBuffer
protected

buffer pointers

Definition at line 175 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_GPUBufferLock
protected

Definition at line 184 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_IsCPUBufferDirty
protected

Definition at line 180 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_IsGPUBufferDirty
protected

checks if buffer needs to be updated

Definition at line 179 of file itkGPUDataManager.h.

cl_mem_flags itk::GPUDataManager::m_MemFlags
protected

buffer type

Definition at line 172 of file itkGPUDataManager.h.

SimpleFastMutexLock itk::GPUDataManager::m_Mutex
protected

Mutex lock to prevent r/w hazard for multithreaded code

Definition at line 187 of file itkGPUDataManager.h.



Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo