CLIJ binary operation returns image with value 1 (would expect 255)

Hi @haesleinhuepf,

I just realized that the binary operations return an image with value 1 (instead of the imagej beloved 255) thus making a barrier to use non-CLIJ binary operation.
Simple workaround you have to multiply the image by 255 and it works again, but…

Thank you again for the amazing tool you made available for the communit!

Cheers,

Romain

1 Like

Hey @romainGuiet,

yes, it’s a pitty that ImageJ only understands 255 as “True” and images with 0 and 255 as binary images. But we need to live with that for backwards-compatibility reasons. CLIJ has a method to make the barrier lower: pullBinary() pulls an image from GPU memory which is correctly recognized by ImageJ as binary image. Furthermore, clij interprets any image as binary image following the convention false = 0 and true != false. Hence, any value other than 0 will be interpreted as true when working with binary operations.

There is also a short explanation about that in the FAQ section. If you see any other place where it would be better visible for end users, let me know! Happy to improve the docs.

I hope that helps :slight_smile:

Cheers,
Robert

2 Likes

:thinking:
which might make sense while coding
BUT
when using the imagej gui, it’s a bit unfortunate…
:grimacing:

Could it be a “preference” one user can set ?

Best,

R

1 Like

Hehe, that’s a great idea! I just put it on the wish list. Maybe there is a way to do this. https://github.com/clij/clijx/issues/10

I strongly vote against preferences of that kind. I’ve had a numerus issues with collaborators using IJ macros which did different things because of different settings in ImageJ. CLIJ was carefully crafted to not have such settings. Thus, it behaves the same everywhere. You may also have seen that CLIJ has no “dark background” option of any kind. True is 1 and false is 0. Believe me, it makes so many things much easier. :wink:

But thanks for the feedback! Keep it coming, it’s very much appreciated!

Cheers,
Robert

3 Likes

:sweat_smile: you’re so right I sometimes forget how preferences can be a nightmare !
R

1 Like