-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmaximumProjection.groovy
More file actions
38 lines (26 loc) · 895 Bytes
/
maximumProjection.groovy
File metadata and controls
38 lines (26 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// This script shows how generate a maximum Z projection using CLIJ and Groovy.
//
// Author: Robert Haase (@haesleinhuepf)
// April 2019
//
////////////////////////////////////////
import ij.IJ;
import net.haesleinhuepf.clij2.CLIJ2;
IJ.run("Close All");
// Init GPU
clij2 = CLIJ2.getInstance();
// get some example data
imp = IJ.openImage("http://imagej.nih.gov/ij/images/t1-head.zip");
// create and fill memory in GPU
imageInput = clij2.push(imp);
long[] dimensions = [imageInput.getWidth(), imageInput.getHeight()];
imageOutput = clij2.create(dimensions, imageInput.getNativeType());
// process the image
clij2.maximumZProjection(imageInput, imageOutput);
// show the result
clij2.show(imageOutput, "output");
// get the result back as variable
result = clij2.pull(imageOutput);
IJ.run("Enhance Contrast", "saturated=0.35");
// clean up
clij2.clear();