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

Allow more flexible image input options #71

Open
imagejan opened this issue Oct 28, 2017 · 4 comments
Open

Allow more flexible image input options #71

imagejan opened this issue Oct 28, 2017 · 4 comments

Comments

@imagejan
Copy link
Member

Currently, module inputs of type Img (and ImagePlus, Dataset, etc. via converters) are handled by ObjectWidget and SwingObjectWidget that offer a simple JComboBox with a list of convertible objects.
It would be nice to offer more flexibility via a style attribute, to allow:

  • reading images from files (style="file")
  • choosing from either a list of open images, or a file (style="file-or-image")

Another (maybe more elegant) option would be to create a singleton object that shows up as "Load from file..." option in any dropdown list for image inputs, thereby allowing to choose an open image or load from file at will.

See saalfeldlab/bigwarp#42 (comment) for the discussion that triggered this issue.

@tischi
Copy link

tischi commented Jun 7, 2018

I would like to weight in here! For using commands both from within the GUI and headless ("write once run everywhere") I would find it almost essential to have the style="file-or-image" option working. Because, within the GUI, you typically want to choose the image from the currently open images, but using the exact same command headless you always want to give the path to a file. My personal current solution is that also for running from within the GUI, I am asking for files, which is not ideal.

@tischi
Copy link

tischi commented Jun 7, 2018

...for the headless use-case: would it also be possible that the Context realizes that the Command is called headless, thus knows that images cannot come from the GUI, and thus any Image parameter automatically would also take filepaths as a input?

@imagejan
Copy link
Member Author

imagejan commented Nov 4, 2019

@tischi wrote:

would it also be possible that the Context realizes that the Command is called headless, thus knows that images cannot come from the GUI, and thus any Image parameter automatically would also take filepaths as a input?

I think it wouldn't even be necessary to detect we're running headless. The presence of a Converter<String, Img> or Converter<String, Dataset> (that internally call DatasetIOService#open to create a Dataset) could be sufficient.

The question is whether having such converters (from String to almost everything) would lead to issues somewhere else where such a conversion would not be desired.

@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/new-colocalization-cross-correlation-plugin-looking-for-feedback/49492/2

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

3 participants