scifio / scifio-ome-xml

SCIFIO plug-in providing support for the OME data model, including readers, writers and translators for OME-XML and OME-TIFF formats.
http://scif.io/
BSD 2-Clause "Simplified" License
2 stars 3 forks source link

Support OME-TIFFs with non-compliant file extensions #11

Open hadim opened 10 years ago

hadim commented 10 years ago

Don't you think Tiff files should be checked even if they only have .tiff or .tif extension ?

In OMETIFFFormat.java:

    @Override
    protected String[] makeSuffixArray() {
        return new String[] { "ome.tif", "ome.tiff" };
    }

could become

    @Override
    protected String[] makeSuffixArray() {
        return new String[] { "ome.tif", "ome.tiff", "tif", "tiff" };
    }

Now I don't know at which point it's computer heavy to test for OME Tiff format.

According to isFormat in Checker (line 463), false is returned pretty quickly if xml string is not detected (see line 490). So between line 466 and line 485, it's all about reading the first IFD, which should has been done anyway.

hinerm commented 10 years ago

By the OME-TIFF specification the OME-TIFF format must end in ome.tif or ome.tiff, so we can not add more suffix checking to this Format.

If it's some variant of .tif or .tiff it will likely come down to reading IFDs, as you mentioned, which has to be left up to the individual TIFF format (though a TIFFService would allow us to parse the IFD once and then pass it around, instead of reparsing for each TIFF flavor).

hadim commented 10 years ago

Ok. Thanks !

ctrueden commented 10 years ago

@hinerm: While it is true that the OME-TIFF specification mandates the use of .ome.tif or .ome.tiff extension, that was not always the case. So there are unfortunately older OME-TIFF files in the wild with extension .tif and .tiff and Bio-Formats makes an effort to support them. SCIFIO will need to do the same.

However, simply adding .tif to the list of suffixes of OMETIFFFormat is probably not the right answer. The Bio-Formats library currently sets suffixNecessary and suffixSufficient to false to handle this case.

Anyway, I'm going to reopen this issue to make sure that TIFF files without .ome.tif extension are still handled properly as OME-TIFFs, at least to the extent feasible.