Closed imagejan closed 2 years ago
What I did so far in this pull request:
StringToImagePlusConverter
. This test fails with the current state of master
.canConvert(Object, Type)
in addition to canConvert(Object, Class)
which makes the above test pass. Actually, the Class
-based signature doesn't seem to get called at all under test conditions, as the test also passes if I remove canConvert(Object, Class)
.(OpenedImageTitle)String => Dataset
conversion as well as for input parameters filled by String
values in IJ.run
option strings. I would have expected both tests to fail in absence of an explicit StringToDatasetConverter
that takes care of providing active/opened images, but to my surprise, both tests actually pass.Regarding the last point, I checked which class is returned when calling convertService.getHandler(nonExistentTitle, Dataset.class)
, and (unsurprisingly) we get io.scif.convert.StringToDatasetConverter
(see also https://github.com/scifio/scifio/pull/443). But I was astonished to see that despite the SCIFIO converter kicking in here, the correct opened image seems to be provided nevertheless.
See also https://github.com/imagej/imagej-legacy/issues/246 for related discussion.
This PR no longer works, due to changes in SCIFIO. There's also still a bug in StringToImagePlusConverter.convert(...) method. It doesn't check the destination type to be ImagePlus.
Closed in favor of #272
(@imagejan Sorry! I create a nearly identical PR before finding this one. But thanks to your PR, I found the but in the StringToImagePlusConverter, which would have otherwise caused some trouble.)
We should ensure that
String
values are converted toImagePlus
(orDataset
) objects only if there actually is an already opened image matching the conversion request.If there is no matching image, we shouldn't try to convert (and maybe return
null
), so that other converters can take over and load e.g. from a file path.