Skip to content

Latest commit

 

History

History
145 lines (133 loc) · 8.33 KB

README.md

File metadata and controls

145 lines (133 loc) · 8.33 KB

clij-opencl-kernels

This repository contains a collection of OpenCL kernels for image processing. The CLIJ is build on top of it allowing ImageJ / Fiji users in doing GPU-accelerated image processing without the need for learning OpenCL.

If you use it, please cite it:

Robert Haase, Loic Alain Royer, Peter Steinbach, Deborah Schmidt, Alexandr Dibrov, Uwe Schmidt, Martin Weigert, Nicola Maghelli, Pavel Tomancak, Florian Jug, Eugene W Myers. CLIJ: GPU-accelerated image processing for everyone. Nat Methods (2019) doi:10.1038/s41592-019-0650-1

Why a custom OpenCL-dialect?

OpenCL offers several pixel types, such as uint8, unit16 and float. Theoretically, one has to write OpenCL-kernels specifically for given input- and output-images, such as a kernel for adding images of type float resulting in a float image and a kernel for adding image of type uint8 resulting in an image of type float. Furthermore, OpenCL defines images and buffers. However, as both are arrays of pixel intensities in memory, we wanted to access them in a unified way. As this would result in a ridiculous large number of individual kernel implementations, we used a dialect where placeholders such as IMAGE_src_PIXEL_TYPE represent the pixel type of the output image.

List of placeholders

The following list of placeholders are used at the moment. The name imagename must contain src or dst to differentiate readonly and writeonly images.

Place holder Replacement during runtime
CONVERT_imagename_PIXEL_TYPE
clij_convert_char_sat
clij_convert_uchar_sat
clij_convert_short_sat
clij_convert_ushort_sat
clij_convert_int_sat
clij_convert_uint_sat
clij_convert_float_sat
Convert any number to a given type.
IMAGE_imagename_TYPE
__read_only image3d_t
__read_only image2d_t
__write_only image2d_t
__write_only image3d_t
__global char*
__global uchar*
__global short*
__global ushort*
__global float*
Two dimensional input image type definition.
IMAGE_imagename_PIXEL_TYPE
char
uchar
short
ushort
float
Pixel type definition
GET_IMAGE_DEPTH(imagename)
constant number Image size in Z
GET_IMAGE_HEIGHT(imagename)
constant number Image size in Y
GET_IMAGE_WIDTH(imagename)
constant number Image size in X
POS_imagename_TYPE
int2
int4
Type of coordinate
POS_imagename_INSTANCE(pos0,pos1,pos2,pos3)
int2(pos0, pos1)
int4(pos0,pos1,pos2,pos3)
instantiate variable of coordinate
READ_imagename_IMAGE
read_imageui (2d)
read_imagef (2d)
read_buffer2dc
read_buffer2duc
read_buffer2di
read_buffer2dui
read_buffer2df
read_imageui (3d)
read_imagef (3d)
read_buffer3dc
read_buffer3duc
read_buffer3di
read_buffer3dui
read_buffer3df
Read pixel intensity from a given position
WRITE_imagename_IMAGE
write_imageui (2d)
write_imagef (2d)
write_buffer2dc
write_buffer2duc
write_buffer2di
write_buffer2dui
write_buffer2df
write_imageui (3d)
write_imagef (3d)
write_buffer3dc
write_buffer3duc
write_buffer3di
write_buffer3dui
write_buffer3df
Write pixel intensity to a given position

Known issues

  • Image dimensionality is limited to three dimensions.