/
processTiles3D.ijm
54 lines (42 loc) · 1.28 KB
/
processTiles3D.ijm
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// CLIJ example macro: processTiles3D.ijm
//
// This macro shows how to process images in tiles
//
// Author: Robert Haase
// March 2019
// ---------------------------------------------
run("Close All");
// Get test data
//run("Blobs (25K)");
//open("C:/structure/data/t1-head.tif");
run("T1 Head (2.4M, 16-bits)");
original = "original";
rename(original);
getDimensions(width, height, channels, depth, frames)
// init GPU
run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_clear();
// create output image with 32 bits
result = "result";
newImage(result, "16-bit", width, height, depth);
Stack.setSlice(64);
//Ext.CLIJ2_create3D(result, width, height, depth, 32);
numTilesX = 10;
numTilesY = 10;
numTilesZ = 10;
tileWidth = floor(width / numTilesX);
tileHeight = floor(height / numTilesY);
tileDepth = floor(depth / numTilesZ);
margin = 3;
for (x = 0; x < numTilesX; x++) {
for (y = 0; y < numTilesY; y++) {
for (z = 0; z < numTilesZ; z++) {
Ext.CLIJx_pushTile(original, x, y, z, tileWidth, tileHeight, tileDepth, margin, margin, margin);
Ext.CLIJ2_mean3DBox(original, result, 3, 3, 3);
Ext.CLIJx_pullTile(result, x, y, z, tileWidth, tileHeight, tileDepth, margin, margin, margin);
updateDisplay();
run("Enhance Contrast", "saturated=0.35");
wait(50);
}
}
}