Search in sources :

Example 11 with IFD

use of loci.formats.tiff.IFD in project bioformats by openmicroscopy.

the class OperettaReader method isThisType.

/* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */
@Override
public boolean isThisType(RandomAccessInputStream stream) throws IOException {
    TiffParser p = new TiffParser(stream);
    IFD ifd = p.getFirstIFD();
    if (ifd == null)
        return false;
    Object s = ifd.getIFDValue(XML_TAG);
    if (s == null)
        return false;
    String xml = s instanceof String[] ? ((String[]) s)[0] : s.toString();
    return xml.indexOf("Operetta") < 1024;
}
Also used : IFD(loci.formats.tiff.IFD) TiffParser(loci.formats.tiff.TiffParser)

Example 12 with IFD

use of loci.formats.tiff.IFD in project bioformats by openmicroscopy.

the class PCIReader method getOptimalTileHeight.

/* @see loci.formats.IFormatReader#getOptimalTileHeight() */
@Override
public int getOptimalTileHeight() {
    FormatTools.assertId(currentId, true, 1);
    String file = imageFiles.get(0);
    try {
        if (poi == null) {
            initPOIService();
        }
        RandomAccessInputStream s = poi.getDocumentStream(file);
        TiffParser tp = new TiffParser(s);
        if (tp.isValidHeader()) {
            IFD ifd = tp.getFirstIFD();
            s.close();
            return (int) ifd.getTileLength();
        }
        s.close();
    } catch (FormatException e) {
        LOGGER.debug("Could not retrieve tile height", e);
    } catch (IOException e) {
        LOGGER.debug("Could not retrieve tile height", e);
    }
    return super.getOptimalTileHeight();
}
Also used : IFD(loci.formats.tiff.IFD) TiffParser(loci.formats.tiff.TiffParser) RandomAccessInputStream(loci.common.RandomAccessInputStream) IOException(java.io.IOException) FormatException(loci.formats.FormatException)

Example 13 with IFD

use of loci.formats.tiff.IFD in project bioformats by openmicroscopy.

the class LEOReader method isThisType.

// -- IFormatReader API methods --
/* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */
@Override
public boolean isThisType(RandomAccessInputStream stream) throws IOException {
    TiffParser parser = new TiffParser(stream);
    parser.setDoCaching(false);
    IFD ifd = parser.getFirstIFD();
    if (ifd == null)
        return false;
    return ifd.containsKey(LEO_TAG);
}
Also used : IFD(loci.formats.tiff.IFD) TiffParser(loci.formats.tiff.TiffParser)

Example 14 with IFD

use of loci.formats.tiff.IFD in project bioformats by openmicroscopy.

the class MIASReader method isThisType.

/* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */
@Override
public boolean isThisType(RandomAccessInputStream stream) throws IOException {
    TiffParser tp = new TiffParser(stream);
    IFD ifd = tp.getFirstIFD();
    if (ifd == null)
        return false;
    Object s = ifd.getIFDValue(IFD.SOFTWARE);
    if (s == null)
        return false;
    String software = null;
    if (s instanceof String[])
        software = ((String[]) s)[0];
    else
        software = s.toString();
    return software.startsWith("eaZYX") || software.startsWith("SCIL_Image") || software.startsWith("IDL");
}
Also used : IFD(loci.formats.tiff.IFD) TiffParser(loci.formats.tiff.TiffParser)

Example 15 with IFD

use of loci.formats.tiff.IFD in project bioformats by openmicroscopy.

the class FEITiffReader method isThisType.

// -- IFormatReader API methods --
/* @see loci.formats.IFormatReader#isThisType(RandomAccessInputStream) */
@Override
public boolean isThisType(RandomAccessInputStream stream) throws IOException {
    TiffParser tp = new TiffParser(stream);
    IFD ifd = tp.getFirstIFD();
    if (ifd == null)
        return false;
    return ifd.containsKey(SFEG_TAG) || ifd.containsKey(HELIOS_TAG) || ifd.containsKey(TITAN_TAG);
}
Also used : IFD(loci.formats.tiff.IFD) TiffParser(loci.formats.tiff.TiffParser)

Aggregations

IFD (loci.formats.tiff.IFD)121 TiffParser (loci.formats.tiff.TiffParser)74 RandomAccessInputStream (loci.common.RandomAccessInputStream)51 CoreMetadata (loci.formats.CoreMetadata)33 FormatException (loci.formats.FormatException)32 MetadataStore (loci.formats.meta.MetadataStore)21 IFDList (loci.formats.tiff.IFDList)21 PhotoInterp (loci.formats.tiff.PhotoInterp)18 IOException (java.io.IOException)17 Location (loci.common.Location)15 ArrayList (java.util.ArrayList)14 Timestamp (ome.xml.model.primitives.Timestamp)11 Length (ome.units.quantity.Length)10 Time (ome.units.quantity.Time)8 TiffIFDEntry (loci.formats.tiff.TiffIFDEntry)7 TiffRational (loci.formats.tiff.TiffRational)6 File (java.io.File)5 TiffReader (loci.formats.in.TiffReader)5 NonNegativeInteger (ome.xml.model.primitives.NonNegativeInteger)5 PositiveInteger (ome.xml.model.primitives.PositiveInteger)5