Labkit output segmentation not available in IJ macro run from command line
Hi,
I've got a macro running with Labkit for segmentation - everything is fine, even ran in batch mode. But it doesn't work when IJ is ran from cmd line. Code as follow
run("Segment Image With Labkit", "segmenter_file=pretrained_classifier.classifier use_gpu=true"); while (!isOpen(output)) {wait(1000);} //(output is just the input image with Labkit added prefix)
When trying to run IJ from command line, nothing happens. Likely the output image (segmentation/probability map) remains unavailable for selection in IJ, can't be selected, so the wait doesn't ends. No issue when ran form IJ directly, batch mode or not. Is there any way to solve or go around this?
Hello @Alxcho, thank you for taking the time to report this problem.
I already noticed problem like this in the past. I added two commands as a workaround:
- Segment Image With Labkit (IJ)
- Calculate Probability Map With Labkit (IJ)
They are supposed to work better with ImageJ Macros.
You will only have those commands if the Labkit update site is activated. Could you please try to activate the Labkit update site, and then test if the other command "Segment Image With Labkit (IJ)" works for you?
I'm curios if that would fix the problem.
Hi @maarzt,
Thanks for your answer and update, this is awesome. I am currently testing the "Segment Image With Labkit (IJ)"command but it seems to be running into further issues: it works but somehow not always and the processing hangs at some point, not quite sure why.
FYI, there is a workaround that works already: using the "from directory" commands instead of trying to process an opened image. That requires extra disk access obviously, but it's stable.
Hope this helps, A.
Hello, I got stuck at the same problem you had, when I could not load classifier into macro properly. Could you share your solution, please? I am running out of ideas at this point.
Hi. For single plane images, run("Calculate Probability Map With Labkit", "input=... segmenter_file=... use_gpu=...") should do the trick as long as all ... are set correctly.