35 m_Output->SetPixelType(m_Input->GetPixelType());
38 m_Output->InitializeMITKImage();
40 const unsigned int dimension = m_Input->GetDimension();
41 unsigned int* dimensions = m_Input->GetDimensions();
43 m_Output->SetDimensions( dimensions );
44 m_Output->SetDimension( (
unsigned short)dimension );
46 m_Output->GetMITKImage()->Initialize( this->GetOutputType(), dimension, dimensions);
48 m_Output->GetMITKImage()->SetSpacing( p_slg->GetSpacing() );
49 m_Output->GetMITKImage()->SetGeometry( m_Input->GetMITKImage()->GetGeometry() );
51 return this->m_Output;
59 void* pData = m_Output->TransferDataToCPU(m_CommandQue);
61 const unsigned int dimension = m_Input->GetDimension();
62 unsigned int* dimensions = m_Input->GetDimensions();
68 m_Output->GetMITKImage()->Initialize( this->GetOutputType(), dimension, dimensions);
69 m_Output->GetMITKImage()->SetSpacing( p_slg->GetSpacing());
70 m_Output->GetMITKImage()->SetGeometry( m_Input->GetMITKImage()->GetGeometry() );
76 return m_Output->GetMITKImage();
82 const cl_image_format* currentImFormat = this->m_Input->
GetPixelType();
85 switch( currentImFormat->image_channel_data_type )
88 return mitk::MakeScalarPixelType<unsigned char>();
89 case CL_UNSIGNED_INT8:
90 return mitk::MakeScalarPixelType<unsigned char>();
92 return mitk::MakeScalarPixelType<short>();
94 return mitk::MakeScalarPixelType<short>();
100 return (this->m_CurrentType + 1);
107 if( m_Input.IsNull() )
111 const unsigned int uiImageWidth = m_Input->GetDimension(0);
112 const unsigned int uiImageHeight = m_Input->GetDimension(1);
113 const unsigned int uiImageDepth = m_Input->GetDimension(2);
116 this->SetWorkingSize( 8, uiImageWidth, 8, uiImageHeight , 8, uiImageDepth );
118 cl_mem clBuffIn = m_Input->GetGPUImage(this->m_CommandQue);
119 cl_mem clBuffOut = m_Output->GetGPUBuffer();
123 if ( m_Input->TransferDataToGPU(m_CommandQue) != CL_SUCCESS )
125 mitkThrow()<<
"Could not create / initialize gpu image.";
128 clBuffIn = m_Input->GetGPUImage(m_CommandQue);
135 MITK_DEBUG <<
"Create GPU Image call " << uiImageWidth<<
"x"<<uiImageHeight<<
"x"<<uiImageDepth;
136 clBuffOut = m_Output->CreateGPUImage(uiImageWidth, uiImageHeight, uiImageDepth, this->m_CurrentType + 1);
140 clErr = clSetKernelArg(ckKernel, 0,
sizeof(cl_mem), &clBuffIn);
141 clErr |= clSetKernelArg(ckKernel, 1,
sizeof(cl_mem), &clBuffOut);
144 if( clErr != CL_SUCCESS )
147 return( clErr == CL_SUCCESS );
#define CHECK_OCL_ERR(_er)
itk::SmartPointer< Self > Pointer
std::string GetOclErrorAsString(int _clErr)
Returns the name of an OpenCL Error as a string.
itk::ImageIOBase::IOPixelType GetPixelType() const
virtual ~OclImageToImageFilter()
Destructor.
virtual mitk::PixelType GetOutputType()
(Virtual) method returning the format in which the output image will be returned
virtual int GetBytesPerElem()
Get the memory size needed for each element.
OclImageToImageFilter()
OclImageToImageFilter Default constructor.
mitk::OclImage::Pointer m_Output
mitk::OclImage::Pointer GetGPUOutput()
Returns a pointer to the graphics memory.
mitk::Image::Pointer GetOutput()
Returns an mitk::Image::Pointer containing the filtered data.
bool InitExec(cl_kernel ckKernel)
InitExec Initialize the execution.
Class for defining the data type of pixels.