Loading data set fails

Hi ImageJ users/devs,

I’m trying to open a dataset like this:

Dataset data = (Dataset) ij.io().open("src/main/resources/confocal-series.tif");

and retrieve this error message:

log4j:WARN No appenders could be found for logger (org.bushe.swing.event.EventService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.UnsupportedOperationException: Attempting to read or write from a io.scif.io.VirtualHandle. There is no source to operate on.
	at io.scif.io.VirtualHandle.read(VirtualHandle.java:82)
	at io.scif.io.RandomAccessInputStream.read(RandomAccessInputStream.java:436)
	at io.scif.formats.KontronFormat$Checker.isFormat(KontronFormat.java:153)
	at io.scif.AbstractChecker.isFormat(AbstractChecker.java:92)
	at io.scif.services.DefaultFormatService.getFormatList(DefaultFormatService.java:341)
	at io.scif.services.DefaultFormatService.getFormat(DefaultFormatService.java:316)
	at io.scif.services.DefaultDatasetIOService.canOpen(DefaultDatasetIOService.java:82)
	at io.scif.io.DatasetIOPlugin.supportsOpen(DatasetIOPlugin.java:64)
	at org.scijava.io.IOService.getOpener(IOService.java:55)
	at org.scijava.io.DefaultIOService.open(DefaultIOService.java:66)
	at howto.processing.CropConfocalSeries.firstSolution(CropConfocalSeries.java:43)
	at howto.processing.CropConfocalSeries.main(CropConfocalSeries.java:90)

Can anybody tell me what it means? The file exists in the specified folder and I also tried with the original online:
https://imagej.nih.gov/ij/images/confocal-series.zip … the error message stays the same…

And hint is appreciated!

Thanks,
Robert

Thanks @haesleinhuepf for bringing this up.

I ran into the same issue a few years ago and opened an issue in the scifio repository:

I don’t know if @gab1one’s recent work on DataHandles in SCIFIO solves any of this.
@haesleinhuepf did you also try with the latest release of scifio.jar? (You might also need to update scifio-bf-compat.jar to be compatible.)

Hey @imagejan,

I just updated scijava-pom to 27.0.1 and the error is still the same. Maybe we shouldn’t merge this how-to before this bug is fixed upstream.

Thanks!

Cheers,
Robert

I found the solution It’s

Dataset data = (Dataset) ij.io().open(Object.class.getResource("/confocal-series.tif").getPath());