CLIJ2 v Paste 3D Bug

Hi @haesleinhuepf,

I noticed a bug (I think, unless I’m using it incorrectly) in the Paste 3D command of CLIJ2. I would like to paste an image onto a stack and would like to place that somewhere other than the first slice. However, this command will only place it on the first slice. It also creates that n+1 number of desired slices (I know this is common discrepancy with ImageJ and CLIJ about 0s and 1s).
Below is screenshot of the command on Blobs, the resulting stack with the image placed at the first slice instead of the third (or fourth), and the readout from the Macro recorder. Let me know if you need anything else from me to repeat this. Thanks!

1 Like

Hi @Nik ,

you may indeed have found a bug here. Pasting 2D images into 3D images wasn’t on my radar yet. I’ll take a closer look into this soon.

In the meantime, you can use the copySlice function which can be used to insert a slice into a stack. This example macro demonstrates it:

// clean up first

// get example data

// init GPU
run("CLIJ2 Macro Extensions", "cl_device=");

// push image to GPU
source = getTitle();

// create a stack on the GPU
Ext.CLIJ2_getDimensions(source, width, height, depth);
number_of_slices = 10;
Ext.CLIJ2_create3D(stack, width, height, number_of_slices, bitDepth());
// initialize stack with 0
Ext.CLIJ2_set(stack, 0);

// position slice in stack
destination_z = 5.0;
Ext.CLIJ2_copySlice(source, stack, destination_z);

Yes, we unified this in clij. All coordinates x, y and z are indiced starting at zero.

Let me know if this helps!


1 Like

Hi again @Nik ,

ok, the bug in clij2 is fixed. It will become available via update site in a couple of days. You could do me a favor and download the clij2_- (910.5 KB) and replace the other clij2.jar in your Fijis plugins directory to test if it works now as expected.

Thanks again for reporting the bug. You made clij2 better today!



I replaced with the hotfix, and it is now working! I’ll keep my eye out for the new update. Thanks for the quick turnaround :grinning:


Thanks for testing it so quickly :raised_hands:

This community is awesome :sun_with_face:

1 Like