Get file informations from a Dataset object

Currently I use IJ1 to get file informations about a dataset :

ImagePlus imp = convert.convert(dataset, ImagePlus.class);
final FileInfo fileInfo = imp.getOriginalFileInfo();
        if (fileInfo != null) {
            this.imageFileName = fileInfo.fileName;
            this.imageFolder =;

I found nothing equivalent in IJ2 when I only have the Dataset (coming from parameter annotation of a plugin).

I guess this kind of information are only inside a SCIFIO Reader and not Dataset. How could I retrieve the Reader from the Dataset ?

I didn’t pay attention but getSource is what I need :

1 Like

Great, glad you found a solution for now.

That API will very likely change in the future. There is a properties table for each Dataset via the getProperties() method, which also has stuff, including (IIRC) the SCIFIO Reader used. These keys are subject to change, though.

Using String for source was a mistake; we are remedying this with the SciJava Common 3 (“SJC3”) redesign of the I/O subpackage. There will be a new interface Location which can be extended in various ways to indicate where your data came from. Data: it’s not just on your disk anymore! ™

1 Like