Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkOclDataSet.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkOclDataSet_h
14 #define mitkOclDataSet_h
15 
16 #define GPU_DATA 0
17 #define CPU_DATA 1
18 
19 #include <mitkImage.h>
20 #include "MitkOpenCLExports.h"
21 
22 #include "mitkOclBaseData.h"
23 #include "mitkOpenCLActivator.h"
24 
25 #include <mitkException.h>
26 
27 namespace mitk {
28 
36 class MITKOPENCL_EXPORT OclDataSet : public OclBaseData
37 {
38 public:
40  itkFactorylessNewMacro(Self);
41  itkCloneMacro(Self);
42 
44  virtual int TransferDataToGPU(cl_command_queue);
45 
47  virtual void* TransferDataToCPU(cl_command_queue);
48 
50  void* GetData()
51  {
52  return m_Data;
53  }
54 
56  cl_mem GetGPUBuffer();
57 
61  cl_mem CreateGPUBuffer();
62 
67  bool IsModified(int _type);
68 
69  using OclBaseData::Modified;
70 
75  void Modified(int _type);
76 
78  void SetData(void* data)
79  {
80  this->m_cpuModified = true;
81  this->m_gpuModified = false;
82  m_Data = data;
83  }
84 
86  size_t GetBufferSize() const
87  {
88  return this->m_bufferSize;
89  }
90 
91  short GetBytesPerElement() const
92  {
93  return this->m_BpE;
94  }
95 
97  void SetBufferSize(size_t size);
98 
100  void SetBpE(unsigned short BpE);
101 
102 protected:
104  OclDataSet();
105 
107  virtual ~OclDataSet();
108 
110  cl_mem m_gpuBuffer;
111 
113  cl_context m_context;
114 
115 private:
117  size_t m_bufferSize;
118 
119  bool m_gpuModified;
120  bool m_cpuModified;
121 
123  void* m_Data;
124 
126  unsigned short m_BpE;
127 };
128 
129 }
130 #endif
mitk::OclDataSet::m_gpuBuffer
cl_mem m_gpuBuffer
Definition: mitkOclDataSet.h:110
mitkException.h
mitk::OclDataSet::m_context
cl_context m_context
Definition: mitkOclDataSet.h:113
mitkOpenCLActivator.h
mitk::OclDataSet::GetBytesPerElement
short GetBytesPerElement() const
Definition: mitkOclDataSet.h:91
mitkImage.h
mitk::OclDataSet::GetBufferSize
size_t GetBufferSize() const
returns the amount of elements in the DataSet
Definition: mitkOclDataSet.h:86
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::OclDataSet::SetData
void SetData(void *data)
Initialze the OclDataSet with data.
Definition: mitkOclDataSet.h:78
mitk::OclDataSet
Class implementing processing of arbitrary data sets for GPU Image Processing.
Definition: mitkOclDataSet.h:36
mitkOclBaseData.h
mitk::OclDataSet::GetData
void * GetData()
Returns the pointer to the referenced data.
Definition: mitkOclDataSet.h:50
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::OclBaseData
Definition: mitkOclBaseData.h:28