Skip to content

Commit

Permalink
Merge pull request #6 from clij/watershed
Browse files Browse the repository at this point in the history
add macro for drawing a grid
  • Loading branch information
haesleinhuepf authored Nov 5, 2019
2 parents 6d7c713 + 66af896 commit e55f7e5
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/main/macro/grid.ijm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// grid_GPU.ijm
//
// Draws a grid in an emppty image on the GPU.
// You need to install this update sites in Fiji:
// * clij
// * clij2
//
// Author: Robert Haase, rhaase@mpi-cbg.de
// November 2019
//------------------------------------------------

// image size
width = 1000;
height = 1000;

// grid config
gridspacing = 50;
thickness = 1.1;

// define the image name
image = "image";

// initialize GPU
run("CLIJ Macro Extensions", "cl_device=[Intel(R) UHD Graphics 620]");

// create an empty image on the GPU
Ext.CLIJ_create2D(image, width, height, 8);

// initialize the image with zeros
Ext.CLIJ_set(image, 0);

for(x = 0; x < width; x += gridspacing) {
for(y = 0; y < height; y += gridspacing) {
// vertical line
x1 = x;
x2 = x;
y1 = 0;
y2 = height;
z1 = 0;
z2 = 0;
Ext.CLIJx_drawLine(image, x1, y1, z1, x2, y2, z2, thickness);

// horizontal line
x1 = 0;
x2 = width;
y1 = y;
y2 = y;
z1 = 0;
z2 = 0;
Ext.CLIJx_drawLine(image, x1, y1, z1, x2, y2, z2, thickness);
}
}
Ext.CLIJ_pull(image);

0 comments on commit e55f7e5

Please # to comment.