use of ome.units.quantity.Length 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 ome.units.quantity.Length 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 ome.units.quantity.Length 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 ome.units.quantity.Length in project bioformats by openmicroscopy.
the class FormatReaderTest method testEmissionWavelengths.
@Test(groups = { "all", "fast", "automated" })
public void testEmissionWavelengths() {
if (config == null)
throw new SkipException("No config tree");
String testName = "EmissionWavelengths";
if (!initFile())
result(testName, false, "initFile");
IMetadata retrieve = (IMetadata) reader.getMetadataStore();
for (int i = 0; i < reader.getSeriesCount(); i++) {
config.setSeries(i);
for (int c = 0; c < config.getChannelCount(); c++) {
Length realWavelength = retrieve.getChannelEmissionWavelength(i, c);
Length expectedWavelength = config.getEmissionWavelength(c);
if (realWavelength == null && expectedWavelength == null) {
continue;
}
if (!isAlmostEqual(expectedWavelength, realWavelength)) {
result(testName, false, "Series " + i + " channel " + c + " (expected " + expectedWavelength + ", actual " + realWavelength + ")");
}
}
}
result(testName, true);
}
use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class FormatReaderTest method testPhysicalSizeX.
@Test(groups = { "all", "fast", "automated" })
public void testPhysicalSizeX() {
if (config == null)
throw new SkipException("No config tree");
String testName = "PhysicalSizeX";
if (!initFile())
result(testName, false, "initFile");
IMetadata retrieve = (IMetadata) reader.getMetadataStore();
for (int i = 0; i < reader.getSeriesCount(); i++) {
config.setSeries(i);
Length expectedSize = config.getPhysicalSizeX();
Length realSize = retrieve.getPixelsPhysicalSizeX(i);
if (!isAlmostEqual(realSize, expectedSize)) {
result(testName, false, "Series " + i + " (expected " + expectedSize + ", actual " + realSize + ")");
}
}
result(testName, true);
}
Aggregations