Search in sources :

Example 41 with MetadataRetrieve

use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.

the class LociFunctions method getPlaneTimingDeltaT.

public void getPlaneTimingDeltaT(Double[] deltaT, Double no) {
    int imageIndex = r.getSeries();
    int planeIndex = getPlaneIndex(r, no.intValue());
    MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
    Double val = Double.NaN;
    if (planeIndex >= 0) {
        Time valTime = retrieve.getPlaneDeltaT(imageIndex, planeIndex);
        if (valTime != null) {
            val = valTime.value(UNITS.SECOND).doubleValue();
        }
    }
    deltaT[0] = val;
}
Also used : Time(ome.units.quantity.Time) MetadataRetrieve(loci.formats.meta.MetadataRetrieve)

Example 42 with MetadataRetrieve

use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.

the class LociFunctions method getPixelsPhysicalSizeZ.

public void getPixelsPhysicalSizeZ(Double[] sizeZ) {
    int imageIndex = r.getSeries();
    MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
    Length z = retrieve.getPixelsPhysicalSizeZ(imageIndex);
    if (z != null) {
        sizeZ[0] = z.value(UNITS.MICROMETER).doubleValue();
    }
    if (sizeZ[0] == null)
        sizeZ[0] = new Double(Double.NaN);
}
Also used : Length(ome.units.quantity.Length) MetadataRetrieve(loci.formats.meta.MetadataRetrieve)

Example 43 with MetadataRetrieve

use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.

the class LociFunctions method getPlanePositionY.

public void getPlanePositionY(Double[] positionY, Double no) {
    int imageIndex = r.getSeries();
    int planeIndex = getPlaneIndex(r, no.intValue());
    MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
    Length val = null;
    if (planeIndex >= 0) {
        val = retrieve.getPlanePositionY(imageIndex, planeIndex);
    }
    if (val == null) {
        val = new Length(Double.NaN, UNITS.REFERENCEFRAME);
    }
    positionY[0] = val == null ? Double.NaN : val.value(UNITS.REFERENCEFRAME).doubleValue();
}
Also used : Length(ome.units.quantity.Length) MetadataRetrieve(loci.formats.meta.MetadataRetrieve)

Example 44 with MetadataRetrieve

use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.

the class LociFunctions method getPlaneIndex.

// -- Utility methods --
/**
 * Finds the Plane index corresponding to the given image plane number.
 */
private static int getPlaneIndex(IFormatReader r, int no) {
    MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
    int imageIndex = r.getSeries();
    int planeCount = retrieve.getPlaneCount(imageIndex);
    int[] zct = r.getZCTCoords(no);
    for (int i = 0; i < planeCount; i++) {
        Integer theC = retrieve.getPlaneTheC(imageIndex, i).getValue();
        Integer theT = retrieve.getPlaneTheT(imageIndex, i).getValue();
        Integer theZ = retrieve.getPlaneTheZ(imageIndex, i).getValue();
        if (zct[0] == theZ.intValue() && zct[1] == theC.intValue() && zct[2] == theT.intValue()) {
            return i;
        }
    }
    return -1;
}
Also used : MetadataRetrieve(loci.formats.meta.MetadataRetrieve)

Example 45 with MetadataRetrieve

use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.

the class LociFunctions method getPlaneTimingExposureTime.

public void getPlaneTimingExposureTime(Double[] exposureTime, Double no) {
    int imageIndex = r.getSeries();
    int planeIndex = getPlaneIndex(r, no.intValue());
    MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
    Double val = null;
    if (planeIndex >= 0) {
        Time valTime = retrieve.getPlaneExposureTime(imageIndex, planeIndex);
        if (valTime != null) {
            val = valTime.value(UNITS.SECOND).doubleValue();
        }
    }
    exposureTime[0] = val == null ? new Double(Double.NaN) : val;
}
Also used : Time(ome.units.quantity.Time) MetadataRetrieve(loci.formats.meta.MetadataRetrieve)

Aggregations

MetadataRetrieve (loci.formats.meta.MetadataRetrieve)64 FormatException (loci.formats.FormatException)11 MetadataStore (loci.formats.meta.MetadataStore)11 Length (ome.units.quantity.Length)10 ServiceFactory (loci.common.services.ServiceFactory)8 DependencyException (loci.common.services.DependencyException)7 OMEXMLService (loci.formats.services.OMEXMLService)6 RandomAccessInputStream (loci.common.RandomAccessInputStream)5 Time (ome.units.quantity.Time)5 PositiveInteger (ome.xml.model.primitives.PositiveInteger)5 ServiceException (loci.common.services.ServiceException)4 MissingLibraryException (loci.formats.MissingLibraryException)4 Test (org.testng.annotations.Test)4 IndexColorModel (java.awt.image.IndexColorModel)3 Location (loci.common.Location)3 RandomAccessOutputStream (loci.common.RandomAccessOutputStream)3 ImageReader (loci.formats.ImageReader)3 BufferedImage (java.awt.image.BufferedImage)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 File (java.io.File)2