Closed albertoandreottiATgmail closed 3 years ago
Hi @albertoandreottiATgmail ,
the openingBox operation is a binary image filter. If you want to do a similar operation on grey-value images, I would suggest taking a look at maxiumBox and minimumBox.
Does that solve your issue?
Cheers, Robert
Hi @haesleinhuepf , thanks for your answer!. That makes sense as it explains the lack of output using pull(). Will try this. Another thing that I notice is that the call to destinationImagePlus.show() is actually working... but the image only shows when I continue stepping out of the scope with my debugger. So it is possible that we may have some threading problem there? at least with the show() call on the image. Now for the clij2 library are the calls blocking synchronous calls or is there some type of synchronization that needs to happen?
thanks!
So it is possible that we may have some threading problem there?
Hm, I rather think it's an ImageJ-issue. Actually I hit that one quite often. The image is shown on screen and then marked as "not valid". Next time the user clicks something, the image is refreshed. In order to avoid those issues while debugging clij2-scripts, we invented the clij2.show(destination, title);
method. It does not just take ImagePlusses, you can also pass OpenCL-images and buffers ;-) Thus, in your script this should work and is easier to read and write:
clij2.show(destination, "intermediate result");
You find some more details about this on the intro for java developers page. Speaking of the website. I'm just about to update the documentation for developers. Thus, I would love to hear your feedback. What was most complicated to learn when starting with clij, what could be improved on the website?
Thanks!
Cheers, Robert
Hi @haesleinhuepf ! yes it's indeed a threading situation related to the ImagePlus class. I worked around the headache a bit by just registering a listener through ImagePlus.addImageListener(), and waiting for updates there. I'm mostly interested in the BufferedImage, so I do this,
clij2.pull(destination).getBufferedImage()
my concern now is what my guarantees are that the returned BufferedImage is actually gonna be properly filled with the stuff I want in a synchronous manner. Regarding the Java part, to me it was insanely difficult to setup the build. I had to get into a forensic investigation on where each package is, which repo to add, etc. There's room for improvement there.
thanks again!, Alberto.
my concern now is what my guarantees are that the returned BufferedImage is actually gonna be properly filled with the stuff I want in a synchronous manner.
You shoud be fine. There is no asynchronous buffer copying in clij. If you're interested in the code: Here we're copying the bytes over from the GPU memory and the "true" in that line says, we wait until the copy is completed.
Regarding the Java part, to me it was insanely difficult to setup the build. I had to get into a forensic investigation on where each package is, which repo to add, etc.
Are you using the maven build system in your project as explained here? If not, give it a try! It will simplify your life massively! It is also compatible to Scala.
Cheers, Robert
Hi,
I'm using the Java API(from Scala), and it's getting really hard to obtain a result other that a black image out of any of the transformations that I've tried. What should be the input format for the images? I've tried all sort of images including grayscale 8-bit images, with no success. The situation changes when I pull the image from the GPU using pullBinary() instead of pull(). This is my code,
Still, I would like at least a grayscale image as output, not a binary one. @haesleinhuepf