-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from clij/watershed
add macro for drawing a grid
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|