Error opening .lif data with SCIFIO ImgOpener

Tags: #<Tag:0x00007fa3043ec688> #<Tag:0x00007fa3043ec520> #<Tag:0x00007fa3043ec3e0> #<Tag:0x00007fa3043ec2a0>


Hi All,

I’ve just begun exploring coding plugins with ImgLib2 and SCIFIO and I’ve run into some difficulties opening images with the ImgOpener class. Essentially, I’m trying to open a particular image series within a particular file:

public class ImageOpener {
    public static < T extends RealType< T> & NativeType< T>> Img openImage(String path,int series) throws ImgIOException {
        SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetIndex(series);
        return (Img< T>) new ImgOpener().openImgs(path, config).get(0);

I’ve noticed that the above works fine when the dataset to be opened is 2D, but it fails when a 3D stack to be opened. However, if I use Bio-Formats to open the same image, and then wrap in an instance of Img, it works absolutely fine every time:

public static Img openImage(String fileName, int series) throws FormatException, IOException {
    ImporterOptions io = new ImporterOptions();
    io.setSeriesOn(series, true);
    ImagePlus[  ] imps = BF.openImagePlus(io);
    return ImagePlusAdapter.wrap( imps[0] );

I’m guessing I need to specify more configuration options in the SCIFIOConfig object, but it’s really not clear from the API what I should or should not be doing.

Any assistance would be much appreciated,