5:19, you were up early, @haesleinhuepf! Such devotion…
Ext.CLIJ2_clear() statement right after initialization of the CLIJ2 extensions doesn’t help. I still get
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -36 -> CL_INVALID_COMMAND_QUEUE, sometimes followed by
net.haesleinhuepf.clij.clearcl.exceptions.OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES..
I actually forgot to tell you that
Ext.CLIJ2_mean3DBox works well, but it crashes on
Ext.CLIJ2_median3DBox (or anyother CLIJ2 median command).
And you are right, the downsampling I added only later. (By the way, the console also says
downsample3D is deprecated? It doesn’t look like that in the docs). Here is the complete code, without pushing
run("CLIJ2 Macro Extensions", "cl_device="); Ext.CLIJ2_clear(); run("T1 Head (2.4M, 16-bits)"); image1 = getTitle(); Ext.CLIJ2_push(image1); radius = 2; // compute 3D mean Ext.CLIJ2_mean3DBox(image1, image2, radius, radius, radius); Ext.CLIJ2_pull(image2); // compute 3D median Ext.CLIJ2_downsample3D(image1, image3, 0.5, 0.5, 0.5); Ext.CLIJ2_median3DBox(image3, image4, radius, radius, radius); Ext.CLIJ2_pull(image4); Ext.CLIJ2_clear();
Which automatically brings me to another point: In analysis workflows it often occurs that you want to execute a statement conditionally, e.g. background subtract, filter, etc, based on the user’s input.
For this particular macro, if you want to run it with and without downsampling, besides outcommenting the downsampling you also need to rename the input image in
image3 doesn’t exist. Therefore, one cannot easily have a boolean user input
downsampling and a statement
if(downsampling == true) Ext.CLIJ2_downsample3D(...).
I guess this is a consequence of the (otherwise great) ‘byRef Image’ method. In the past you had made some CLIJ2 commands ‘in place’, but these seem to have been phased out.
Now I was thinking, would it in principle be possible for CL(IJ) to execute commands ‘inplace’ if the destination image variable is set the same as the input image? (e.g. by recognizing that, clearing the input image memory and then renaming the output reference to the input reference.) Or is that inherently very difficult ‘under the CL hood’? It would definitely solve many issues.