use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.
the class LociFunctions method getPixelsPhysicalSizeY.
public void getPixelsPhysicalSizeY(Double[] sizeY) {
int imageIndex = r.getSeries();
MetadataRetrieve retrieve = (MetadataRetrieve) r.getMetadataStore();
Length y = retrieve.getPixelsPhysicalSizeY(imageIndex);
if (y != null) {
sizeY[0] = y.value(UNITS.MICROMETER).doubleValue();
}
if (sizeY[0] == null)
sizeY[0] = new Double(Double.NaN);
}
use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.
the class LociFunctions method getPlanePositionZ.
public void getPlanePositionZ(Double[] positionZ, 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.getPlanePositionZ(imageIndex, planeIndex);
}
if (val == null) {
val = new Length(Double.NaN, UNITS.REFERENCEFRAME);
}
positionZ[0] = val == null ? Double.NaN : val.value(UNITS.REFERENCEFRAME).doubleValue();
}
use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.
the class LociFunctions method getPlanePositionX.
public void getPlanePositionX(Double[] positionX, 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.getPlanePositionX(imageIndex, planeIndex);
}
positionX[0] = val == null ? Double.NaN : val.value(UNITS.REFERENCEFRAME).doubleValue();
}
use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.
the class FormatWriter method getPlaneCount.
/**
* Retrieve the total number of planes in given series.
*/
protected int getPlaneCount(int series) {
MetadataRetrieve r = getMetadataRetrieve();
int z = r.getPixelsSizeZ(series).getValue().intValue();
int t = r.getPixelsSizeT(series).getValue().intValue();
int c = r.getPixelsSizeC(series).getValue().intValue();
c /= r.getChannelSamplesPerPixel(series, 0).getValue().intValue();
return z * c * t;
}
use of loci.formats.meta.MetadataRetrieve in project bioformats by openmicroscopy.
the class FormatWriter method seekToPlaneOffset.
/**
* Seek to the given (x, y) coordinate of the image that starts at
* the given offset.
*/
protected void seekToPlaneOffset(long baseOffset, int x, int y) throws IOException {
out.seek(baseOffset);
MetadataRetrieve r = getMetadataRetrieve();
int samples = getSamplesPerPixel();
int pixelType = FormatTools.pixelTypeFromString(r.getPixelsType(series).toString());
int bpp = FormatTools.getBytesPerPixel(pixelType);
if (interleaved)
bpp *= samples;
int sizeX = r.getPixelsSizeX(series).getValue().intValue();
out.skipBytes(bpp * (y * sizeX + x));
}
Aggregations