51 const unsigned int uiDataSetWidth = dimensions[0];
52 const unsigned int uiDataSetHeight = dimensions[1];
53 const unsigned int uiDataSetDepth = dimensions[2];
56 this->
SetWorkingSize(8, uiDataSetWidth, 8, uiDataSetHeight, 8, uiDataSetDepth);
58 cl_mem clBuffIn =
m_Input->GetGPUBuffer();
59 cl_mem clBuffOut =
m_Output->GetGPUBuffer();
65 mitkThrow() <<
"Could not create / initialize gpu DataSet.";
68 clBuffIn =
m_Input->GetGPUBuffer();
72 if (!clBuffOut || (
size_t)
m_Output->GetBufferSize() != outputDataSize)
74 MITK_DEBUG <<
"Create GPU DataSet call " << uiDataSetWidth <<
"x" << uiDataSetHeight <<
"x" << uiDataSetDepth;
75 MITK_INFO <<
"Create GPU Buffer of size " << outputDataSize * outputBpE / 1024.f / 1024.f <<
"MB";
77 m_Output->SetBufferSize(outputDataSize);
78 clBuffOut =
m_Output->CreateGPUBuffer();
83 clErr = clSetKernelArg(ckKernel, 0,
sizeof(cl_mem), &clBuffIn);
84 clErr |= clSetKernelArg(ckKernel, 1,
sizeof(cl_mem), &clBuffOut);
87 if (clErr != CL_SUCCESS)
90 return(clErr == CL_SUCCESS);
98 const unsigned int uiDataSetWidth = dimensions[0];
99 const unsigned int uiDataSetHeight = dimensions[1];
100 const unsigned int uiDataSetDepth = dimensions[2];
103 this->
SetWorkingSize(8, uiDataSetWidth, 8, uiDataSetHeight, 8, uiDataSetDepth);
105 cl_mem clBuffOut =
m_Output->GetGPUBuffer();
108 if (!clBuffOut || (
size_t)
m_Output->GetBufferSize() != outputDataSize)
110 MITK_DEBUG <<
"Create GPU DataSet call " << uiDataSetWidth <<
"x" << uiDataSetHeight <<
"x" << uiDataSetDepth;
112 m_Output->SetBufferSize(outputDataSize);
113 clBuffOut =
m_Output->CreateGPUBuffer();
117 clErr = clSetKernelArg(ckKernel, 0,
sizeof(cl_mem), &clBuffOut);
120 if (clErr != CL_SUCCESS)
123 return(clErr == CL_SUCCESS);
#define CHECK_OCL_ERR(_er)
virtual int GetBytesPerElem()
Get the memory size needed for each element.
OclDataSetToDataSetFilter()
OclDataSetToDataSetFilter Default constructor.
virtual ~OclDataSetToDataSetFilter()
Destructor.
std::string GetOclErrorAsString(int _clErr)
Returns the name of an OpenCL Error as a string.
mitk::OclDataSet::Pointer m_Output
mitk::OclDataSet::Pointer m_Input
mitk::OclDataSet::Pointer GetGPUOutput()
Returns a pointer to the graphics memory.
void * GetOutput()
Returns an pointer to the filtered data.
bool InitExecNoInput(cl_kernel ckKernel, unsigned int *dimensions, vcl_size_t outputDataSize, unsigned int outputBpE)
cl_command_queue m_CommandQue
Command queue for the filter.
void SetWorkingSize(unsigned int locx, unsigned int dimx, unsigned int locy=1, unsigned int dimy=1, unsigned int locz=1, unsigned int dimz=1)
Set the working size for the following OpenCL kernel call.
unsigned int m_CurrentSizeOutput
bool InitExec(cl_kernel ckKernel, unsigned int *dimensions, vcl_size_t outputDataSize, unsigned int outputBpE)
InitExec Initialize the execution.