21 : m_ckBinaryThreshold( NULL )
26 this->m_LowerThreshold = 10;
27 this->m_UpperThreshold = 200;
29 this->m_InsideValue = 100;
30 this->m_OutsideValue = 0;
35 if ( this->m_ckBinaryThreshold )
37 clReleaseKernel( m_ckBinaryThreshold );
44 if (!this->Initialize())
51 mitkThrow() <<
"Filter is not initialized. Cannot update.";
65 this->InitExec( this->m_ckBinaryThreshold );
69 MITK_ERROR <<
"Catched exception while initializing filter: " << e.what();
74 clErr = clSetKernelArg( this->m_ckBinaryThreshold, 2,
sizeof(cl_int), &(this->m_LowerThreshold) );
75 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 3,
sizeof(cl_int), &(this->m_UpperThreshold) );
76 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 4,
sizeof(cl_int), &(this->m_OutsideValue) );
77 clErr |= clSetKernelArg( this->m_ckBinaryThreshold, 5,
sizeof(cl_int), &(this->m_InsideValue) );
81 this->ExecuteKernel( m_ckBinaryThreshold, 3);
99 this->m_ckBinaryThreshold = clCreateKernel( this->m_ClProgram,
"ckBinaryThreshold", &clErr);
108 if(image->GetDimension() != 3)
111 " 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.
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
#define mitkThrowException(classname)
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.