Search in sources :

Example 46 with Time

use of ome.units.quantity.Time in project bioformats by openmicroscopy.

the class GetPhysicalMetadata method printPhysicalDimensions.

/**
 * Outputs global timing details.
 */
public static void printPhysicalDimensions(IMetadata meta, int series) {
    Length physicalSizeX = meta.getPixelsPhysicalSizeX(series);
    Length physicalSizeY = meta.getPixelsPhysicalSizeY(series);
    Length physicalSizeZ = meta.getPixelsPhysicalSizeZ(series);
    Time timeIncrement = meta.getPixelsTimeIncrement(series);
    System.out.println();
    System.out.println("Physical dimensions:");
    System.out.println("\tX spacing = " + physicalSizeX.value() + " " + physicalSizeX.unit().getSymbol());
    System.out.println("\tY spacing = " + physicalSizeY.value() + " " + physicalSizeY.unit().getSymbol());
    System.out.println("\tZ spacing = " + physicalSizeZ.value() + " " + physicalSizeZ.unit().getSymbol());
    System.out.println("\tTime increment = " + timeIncrement.value(UNITS.SECOND).doubleValue() + " seconds");
}
Also used : Length(ome.units.quantity.Length) Time(ome.units.quantity.Time)

Example 47 with Time

use of ome.units.quantity.Time in project bioformats by openmicroscopy.

the class PrintTimestamps method printGlobalTiming.

/**
 * Outputs global timing details.
 */
public static void printGlobalTiming(IMetadata meta, int series) {
    String imageName = meta.getImageName(series);
    String creationDate = null;
    if (meta.getImageAcquisitionDate(series) != null) {
        creationDate = meta.getImageAcquisitionDate(series).getValue();
    }
    Time timeInc = meta.getPixelsTimeIncrement(series);
    System.out.println();
    System.out.println("Global timing information:");
    System.out.println("\tImage name = " + imageName);
    System.out.println("\tCreation date = " + creationDate);
    if (creationDate != null) {
        System.out.println("\tCreation time (in ms since epoch) = " + DateTools.getTime(creationDate, DateTools.ISO8601_FORMAT));
    }
    System.out.println("\tTime increment (in seconds) = " + timeInc.value(UNITS.SECOND).doubleValue());
}
Also used : Time(ome.units.quantity.Time)

Example 48 with Time

use of ome.units.quantity.Time in project bioformats by openmicroscopy.

the class PrintTimestamps method printTimingPerTimepoint.

/**
 * Outputs timing details per timepoint.
 */
public static void printTimingPerTimepoint(IMetadata meta, int series) {
    System.out.println();
    System.out.println("Timing information per timepoint (from beginning of experiment):");
    int planeCount = meta.getPlaneCount(series);
    for (int i = 0; i < planeCount; i++) {
        Time deltaT = meta.getPlaneDeltaT(series, i);
        if (deltaT == null)
            continue;
        // convert plane ZCT coordinates into image plane index
        int z = meta.getPlaneTheZ(series, i).getValue().intValue();
        int c = meta.getPlaneTheC(series, i).getValue().intValue();
        int t = meta.getPlaneTheT(series, i).getValue().intValue();
        if (z == 0 && c == 0) {
            System.out.println("\tTimepoint #" + t + " = " + deltaT.value(UNITS.SECOND).doubleValue() + " s");
        }
    }
}
Also used : Time(ome.units.quantity.Time)

Example 49 with Time

use of ome.units.quantity.Time in project bioformats by openmicroscopy.

the class TillVisionReader method populateMetadataStore.

// -- Helper methods --
private void populateMetadataStore() throws FormatException {
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this, true);
    for (int i = 0; i < getSeriesCount(); i++) {
        // populate Image data
        if (i < imageNames.size()) {
            store.setImageName(imageNames.get(i), i);
        }
        String date = i < dates.size() ? dates.get(i) : "";
        if (date != null && !date.equals("")) {
            store.setImageAcquisitionDate(new Timestamp(date), i);
        }
    }
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        for (int i = 0; i < getSeriesCount(); i++) {
            for (int q = 0; q < core.get(i).imageCount; q++) {
                if (exposureTimes.get(i) != null) {
                    store.setPlaneExposureTime(new Time(exposureTimes.get(i), UNITS.SECOND), i, q);
                }
            }
            if (i < types.size()) {
                store.setExperimentID(MetadataTools.createLSID("Experiment", i), i);
                store.setExperimentType(getExperimentType(types.get(i)), i);
            }
        }
    }
}
Also used : MetadataStore(loci.formats.meta.MetadataStore) Time(ome.units.quantity.Time) Timestamp(ome.xml.model.primitives.Timestamp)

Example 50 with Time

use of ome.units.quantity.Time 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)

Aggregations

Time (ome.units.quantity.Time)74 Length (ome.units.quantity.Length)46 MetadataStore (loci.formats.meta.MetadataStore)41 Timestamp (ome.xml.model.primitives.Timestamp)33 CoreMetadata (loci.formats.CoreMetadata)30 FormatException (loci.formats.FormatException)24 RandomAccessInputStream (loci.common.RandomAccessInputStream)21 Location (loci.common.Location)20 ArrayList (java.util.ArrayList)17 PositiveInteger (ome.xml.model.primitives.PositiveInteger)13 NonNegativeInteger (ome.xml.model.primitives.NonNegativeInteger)12 IOException (java.io.IOException)10 Temperature (ome.units.quantity.Temperature)9 IFD (loci.formats.tiff.IFD)8 ElectricPotential (ome.units.quantity.ElectricPotential)7 Color (ome.xml.model.primitives.Color)7 IMetadata (loci.formats.meta.IMetadata)6 File (java.io.File)5 DependencyException (loci.common.services.DependencyException)5 ServiceException (loci.common.services.ServiceException)5