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

Input harvesting not working with multiple ImgPluses #349

Closed
hinerm opened this issue Jul 31, 2024 · 6 comments
Closed

Input harvesting not working with multiple ImgPluses #349

hinerm opened this issue Jul 31, 2024 · 6 comments
Assignees
Labels

Comments

@hinerm
Copy link
Member

hinerm commented Jul 31, 2024

If I have a script with multiple @ImgPlus input parameters and multiple images open, the input harvester seems to only recognize the first image as an input option, although it knows there are two options.

image

I would expect to see blobs.gif and blobs-1.gif as options in the combo box. They do indeed seem to be the same options as I tried selecting both first and second entries as the outImage parameter and get a complaint from Ops that the input and output params are the same. (slight chance it is non-deterministic and I just keep getting unlucky and picking the "first" image)

@hinerm hinerm added the Bug label Jul 31, 2024
@hinerm hinerm self-assigned this Jul 31, 2024
@imagejan
Copy link
Member

imagejan commented Aug 6, 2024

Related: imagej/imagej-legacy#171

@hinerm
Copy link
Member Author

hinerm commented Aug 16, 2024

OK part of the problem is definitely that registration of the ImgPlus instances happens too late for the input selection when there are multiple inputs.

If I open clown and blobs and the first script I try to run is:

#@ ImgPlus in1
#@ ImgPlus in2


println(in1)
println(in2)

Then I will actually get "An ImgPlus is required but none is available!" error.

If I:

  1. Remove one of the parameters from the script
  2. Select clown as active
  3. Run the script
  4. Select blobs as active (interchangeable with 2)
  5. Run the script again
  6. Restore the removed script parameter
  7. Run the script one more time

then both clown and blobs will be available as parameters (although listed twice).

I'm guessing we're using a SingleInputPreprocessor and it either isn't working as intended or is insufficient.

@hinerm
Copy link
Member Author

hinerm commented Aug 19, 2024

OK, right now the ActiveImagePreprocessor asks the ImageDisplayService for the current image, which is where the conversion happens.

So whenever multiple image inputs are requested we need to make sure getImageDisplays is called.

@hinerm
Copy link
Member Author

hinerm commented Aug 19, 2024

So whenever multiple image inputs are requested we need to make sure getImageDisplays is called.

This is maybe not true. It just occurred to me to try non-ImgPlus inputs and it does work as expected with multiple Dataset or Img inputs. It's just ImgPlus that breaks.

@hinerm
Copy link
Member Author

hinerm commented Aug 19, 2024

Almost certainly because the converter we have is ImagePlusToDataset. The ConvertService looks for assignable converter output types and Dataset is an Img but not an ImgPlus 🙄🙄🙄🙄🙄

@hinerm hinerm changed the title Input harvesting not working with multiple images Input harvesting not working with multiple ImgPluses Aug 19, 2024
@imagejan
Copy link
Member

Regarding conversion of various image types, see also imagej/imagej-legacy#229 (and imagej/imagej-legacy#186 and imagej/imagej-ops#54 by extension).

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

No branches or pull requests

2 participants