Open imagejan opened 7 years ago
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.
...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?
@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.
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
Currently, module inputs of type
Img
(andImagePlus
,Dataset
, etc. via converters) are handled byObjectWidget
andSwingObjectWidget
that offer a simpleJComboBox
with a list of convertible objects. It would be nice to offer more flexibility via astyle
attribute, to allow:style="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 https://github.com/saalfeldlab/bigwarp/issues/42#issuecomment-340198033 for the discussion that triggered this issue.