17 : m_ckBinaryThreshold( nullptr )
22 this->m_LowerThreshold = 10;
23 this->m_UpperThreshold = 200;
25 this->m_InsideValue = 100;
26 this->m_OutsideValue = 0;
31 if ( this->m_ckBinaryThreshold )
33 clReleaseKernel( m_ckBinaryThreshold );
47 mitkThrow() <<
"Filter is not initialized. Cannot update.";
61 this->
InitExec( this->m_ckBinaryThreshold );
65 MITK_ERROR <<
"Catched exception while initializing filter: " << e.what();
70 clErr = clSetKernelArg( this->m_ckBinaryThreshold, 2,
sizeof(cl_int), &(this->m_LowerThreshold) );
71 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 3,
sizeof(cl_int), &(this->m_UpperThreshold) );
72 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 4,
sizeof(cl_int), &(this->m_OutsideValue) );
73 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 5,
sizeof(cl_int), &(this->m_InsideValue) );
95 this->m_ckBinaryThreshold = clCreateKernel( this->
m_ClProgram,
"ckBinaryThreshold", &clErr);
104 if(image->GetDimension() != 3)
107 " is not 3D. The filter only supports 3D. Please change your input.";
#define CHECK_OCL_ERR(_er)
void SetInput(mitk::OclImage::Pointer image)
SetInput SetInput Set the input image (as mitk::OclImage).
virtual void InvalidateStorage()=0
Remove all invalid (=do not compile) programs from the internal storage.
ServiceReferenceU GetServiceReference(const std::string &clazz)
std::string m_FilterID
Unique ID of the filter, needs to be specified in the constructor of the derived class.
void SetInput(Image::Pointer image)
SetInput Set the input image. Only 3D images are supported for now.
cl_program m_ClProgram
The compiled OpenCL program.
bool Initialize()
Initialize all necessary parts of the filter.
virtual bool IsInitialized()
Returns true if the initialization was successfull.
virtual us::Module * GetModule()
Get the Module of the filter. Needs to be implemented by every subclass. The filter will load the Ope...
void * GetService(const ServiceReferenceBase &reference)
OclBinaryThresholdImageFilter()
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
Module * GetModule() const
mitk::Image::Pointer image
#define mitkThrowException(classname)
mitk::OclImage::Pointer m_Output
bool InitExec(cl_kernel ckKernel)
InitExec Initialize the execution.
bool ExecuteKernel(cl_kernel kernel, unsigned int workSizeDim)
Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes...
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
virtual ~OclBinaryThresholdImageFilter()
void AddSourceFile(const char *filename)
Add a source file from the resource files to the OpenCL shader file list. Multiple files can be added...
Declaration of the OpenCL Resources micro-service.