Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labkit output segmentation not available in IJ macro run from command line #123

Open
Alxcho opened this issue Jan 16, 2025 · 2 comments
Open

Comments

@Alxcho
Copy link

Alxcho commented Jan 16, 2025

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?

@maarzt
Copy link
Collaborator

maarzt commented Jan 16, 2025

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.
Image

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?
Image

I'm curios if that would fix the problem.

@Alxcho
Copy link
Author

Alxcho commented Feb 4, 2025

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.

One thing I noticed with the new (IJ) command is that for some reason, segmenting a Z-stack gives back a multichannel image - there might be some dimension swap occurring in the background. It doesn't seem to be for all stacks, which I don't get. Using the "from directory" commands doesn't run into this issue, using the same pretrained model.

Hope this helps,
A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants