CLIJ2

Logo

GPU accelerated image processing for everyone

CLIJ2 home

drawLine

Draws a line between two points with a given thickness.

All pixels other than on the line are untouched. Consider using set(buffer, 0); in advance.

Category: Visualisation

Usage in ImageJ macro

Ext.CLIJ2_drawLine(Image destination, Number x1, Number y1, Number z1, Number x2, Number y2, Number z2, Number thickness, Number value);

Usage in object oriented programming languages

Java
// init CLIJ and GPU
import net.haesleinhuepf.clij2.CLIJ2;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
CLIJ2 clij2 = CLIJ2.getInstance();

// get input parameters
destination = clij2.create();
float x1 = 1.0;
float y1 = 2.0;
float z1 = 3.0;
float x2 = 4.0;
float y2 = 5.0;
float z2 = 6.0;
float thickness = 7.0;
float value = 8.0;
// Execute operation on GPU
clij2.drawLine(destination, x1, y1, z1, x2, y2, z2, thickness, value);
// show result
destinationImagePlus = clij2.pull(destination);
destinationImagePlus.show();

// cleanup memory on GPU
clij2.release(destination);
Matlab
% init CLIJ and GPU
clij2 = init_clatlab();

% get input parameters
destination = clij2.create();
x1 = 1.0;
y1 = 2.0;
z1 = 3.0;
x2 = 4.0;
y2 = 5.0;
z2 = 6.0;
thickness = 7.0;
value = 8.0;
% Execute operation on GPU
clij2.drawLine(destination, x1, y1, z1, x2, y2, z2, thickness, value);
% show result
destination = clij2.pullMat(destination)

% cleanup memory on GPU
clij2.release(destination);
Icy JavaScript
// init CLIJ and GPU
importClass(net.haesleinhuepf.clicy.CLICY);
importClass(Packages.icy.main.Icy);

clij2 = CLICY.getInstance();

// get input parameters
destination = clij2.create();
x1 = 1.0;
y1 = 2.0;
z1 = 3.0;
x2 = 4.0;
y2 = 5.0;
z2 = 6.0;
thickness = 7.0;
value = 8.0;
// Execute operation on GPU
clij2.drawLine(destination, x1, y1, z1, x2, y2, z2, thickness, value);
// show result
destination_sequence = clij2.pullSequence(destination)
Icy.addSequence(destination_sequence);
// cleanup memory on GPU
clij2.release(destination);
clEsperanto Python (experimental)
import pyclesperanto_prototype as cle

cle.draw_line(destination, x1, y1, z1, x2, y2, z2, thickness, value)

Example scripts

drawLine.ijm
grid.ijm
meshTouchingNeighbors.ijm
mesh_closest_points.ijm

Back to CLIJ2 reference Back to CLIJ2 documentation

Imprint