Skip to content

Commit

Permalink
Merge pull request #28 from clij/bugfix-example
Browse files Browse the repository at this point in the history
bugfix: output buffer must be variables
  • Loading branch information
haesleinhuepf authored Jul 11, 2024
2 parents 8f34372 + ea723bf commit 7ac797b
Showing 1 changed file with 55 additions and 54 deletions.
109 changes: 55 additions & 54 deletions src/main/macro/localMaximum.ijm
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
// localMaximum.ijm
//
// Demonstrates differences between local "maximum" filters in IJ and CLIJ.
//
// Author: haesleinhuepf
// Jan 2019

run("Close All");

for (radius = 1; radius < 4; radius++) {

newImage("original", "8-bit black", 9, 9, 9);
Stack.setSlice(5);
makeRectangle(4, 4, 1, 1);
run("Add...", "value=255 slice");
run("Select None");

selectWindow("original");
run("Duplicate...", "title=orignal1slice");


run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_clear();

Ext.CLIJ2_push("original");
Ext.CLIJ2_push("orignal1slice");



Ext.CLIJ2_maximum3DSphere("original", "maximum3DSphereCLIJ_" + radius, radius, radius, radius);
Ext.CLIJ2_pull("maximum3DSphereCLIJ_" + radius);
zoom("maximum3DSphereCLIJ_" + radius);

Ext.CLIJ2_maximum2DSphere("orignal1slice", "maximum2DSphereCLIJ_" + radius, radius, radius);
Ext.CLIJ2_pull("maximum2DSphereCLIJ_" + radius);
zoom("maximum2DSphereCLIJ_" + radius);

selectWindow("original");
run("Duplicate...", "title=maximum3DIJ_" + radius + " duplicate");
run("Maximum 3D...", "x=" + radius + " y=" + radius + " z=" + radius);
zoom("maximum3DIJ_" + radius);

selectWindow("orignal1slice");
run("Duplicate...", "title=maximum2DIJ_" + radius);
run("Maximum...", "radius=" + radius);
zoom("maximum2DIJ_" + radius);
}

function zoom(title) {
selectWindow(title);
for (i = 0; i < 10; i++) {
run("In [+]");
}
}
// localMaximum.ijm
//
// Demonstrates differences between local "maximum" filters in IJ and CLIJ.
//
// Author: haesleinhuepf
// Jan 2019

run("Close All");

for (radius = 1; radius < 4; radius++) {

newImage("original", "8-bit black", 9, 9, 9);
Stack.setSlice(5);
makeRectangle(4, 4, 1, 1);
run("Add...", "value=255 slice");
run("Select None");

selectWindow("original");
run("Duplicate...", "title=orignal1slice");


run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_clear();

Ext.CLIJ2_push("original");
Ext.CLIJ2_push("orignal1slice");


output = "maximum3DSphereCLIJ_" + radius;
Ext.CLIJ2_maximum3DSphere("original", output, radius, radius, radius);
Ext.CLIJ2_pull(output);
zoom(output);

output = "maximum2DSphereCLIJ_" + radius;
Ext.CLIJ2_maximum2DSphere("orignal1slice", output, radius, radius);
Ext.CLIJ2_pull(output);
zoom(output);

selectWindow("original");
run("Duplicate...", "title=maximum3DIJ_" + radius + " duplicate");
run("Maximum 3D...", "x=" + radius + " y=" + radius + " z=" + radius);
zoom("maximum3DIJ_" + radius);

selectWindow("orignal1slice");
run("Duplicate...", "title=maximum2DIJ_" + radius);
run("Maximum...", "radius=" + radius);
zoom("maximum2DIJ_" + radius);
}

function zoom(title) {
selectWindow(title);
for (i = 0; i < 10; i++) {
run("In [+]");
}
}
Expand Down

0 comments on commit 7ac797b

Please sign in to comment.