@Test(groups = {"config-xml"}) public void writeXML() { setupReader(); if (!initFile(false)) return; String file = reader.getCurrentFile(); LOGGER.info("Generating XML: {}", file); try { Location l = new Location(file); File f = new File(l.getParent(), l.getName() + ".ome.xml"); OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), Constants.ENCODING); MetadataStore store = reader.getMetadataStore(); MetadataRetrieve retrieve = omexmlService.asRetrieve(store); String xml = omexmlService.getOMEXML(retrieve); writer.write(xml); writer.close(); reader.close(); } catch (Throwable t) { LOGGER.info("", t); assert false; } }
String msg = null; try { MetadataStore store = reader.getMetadataStore(); success = omexmlService.isOMEXMLMetadata(store); if (!success) msg = TestTools.shortClassName(store);
@Test(groups = {"all", "fast", "automated"}) public void testImageNames() { if (config == null) throw new SkipException("No config tree"); String testName = "ImageNames"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore(); for (int i=0; i<reader.getSeriesCount(); i++) { config.setSeries(i); String realName = retrieve.getImageName(i); String expectedName = config.getImageName(); if (!expectedName.equals(realName) && !(realName == null && expectedName.equals("null"))) { result(testName, false, "Series " + i + " (got '" + realName + "', expected '" + expectedName + "')"); } } result(testName, true); }
@Test(groups = {"all", "fast", "automated"}) public void testImageDescriptions() { if (config == null) throw new SkipException("No config tree"); String testName = "ImageDescriptions"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore(); for (int i=0; i<reader.getSeriesCount(); i++) { config.setSeries(i); String realDescription = retrieve.getImageDescription(i); if (realDescription != null) { realDescription = realDescription.trim(); } if (config.hasImageDescription()) { String expectedDescription = config.getImageDescription(); if (expectedDescription != null) { expectedDescription = expectedDescription.trim(); } if (!expectedDescription.equals(realDescription) && !(realDescription == null && expectedDescription.equals("null"))) { result(testName, false, "Series " + i + " (got '" + realDescription + "', expected '" + expectedDescription + "')"); } } } result(testName, true); }
@Test(groups = {"all", "fast", "automated"}) public void testChannelNames() { if (config == null) throw new SkipException("No config tree"); String testName = "ChannelNames"; 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++) { String realName = retrieve.getChannelName(i, c); String expectedName = config.getChannelName(c); if (!expectedName.equals(realName) && (realName == null && !expectedName.equals("null"))) { result(testName, false, "Series " + i + " channel " + c + " (got '" + realName + "', expected '" + expectedName + "')"); } } } result(testName, true); }
@Test(groups = {"all", "fast", "automated"}) public void testDetectors() { if (config == null) throw new SkipException("No config tree"); String testName = "Detectors"; 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++) { String expectedDetector = config.getDetector(c); String realDetector = null; try { realDetector = retrieve.getDetectorSettingsID(i, c); } catch (NullPointerException e) { } if (!(expectedDetector == null && realDetector == null)) { if ((expectedDetector == null || !expectedDetector.equals(realDetector)) && (realDetector == null || !realDetector.equals(expectedDetector))) { result(testName, false, "Series " + i + " channel " + c + " (expected " + expectedDetector + ", actual " + realDetector + ")"); } } } } result(testName, true); }
boolean success = true; try { MetadataStore store = reader.getMetadataStore(); MetadataRetrieve retrieve = omexmlService.asRetrieve(store); String xml = omexmlService.getOMEXML(retrieve);
@Test(groups = {"all", "fast", "automated"}) public void testLightSources() { if (config == null) throw new SkipException("No config tree"); String testName = "LightSources"; 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++) { String expectedLightSource = config.getLightSource(c); String realLightSource = null; try { realLightSource = retrieve.getChannelLightSourceSettingsID(i, c); } catch (NullPointerException e) { } if (!(expectedLightSource == null && realLightSource == null) && !expectedLightSource.equals(realLightSource)) { result(testName, false, "Series " + i + " channel " + c + " (expected " + expectedLightSource + ", actual " + realLightSource + ")"); } } } result(testName, true); }
@Test(groups = {"all", "fast", "automated"}) public void testPhysicalSizeY() { if (config == null) throw new SkipException("No config tree"); String testName = "PhysicalSizeY"; 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.getPhysicalSizeY(); Length realSize = retrieve.getPixelsPhysicalSizeY(i); if (!isAlmostEqual(realSize,expectedSize)) { result(testName, false, "Series " + i + " (expected " + expectedSize + ", actual " + realSize + ")"); } } result(testName, true); }
@Test(groups = {"all", "fast", "automated"}) public void testPhysicalSizeZ() { if (config == null) throw new SkipException("No config tree"); String testName = "PhysicalSizeZ"; 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.getPhysicalSizeZ(); Length realSize = retrieve.getPixelsPhysicalSizeZ(i); if (!isAlmostEqual(realSize,expectedSize)) { result(testName, false, "Series " + i + " (expected " + expectedSize + ", actual " + realSize + ")"); } } result(testName, true); }
@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); }
@Test(groups = {"all", "fast", "automated"}) public void testTimeIncrement() { if (config == null) throw new SkipException("No config tree"); String testName = "TimeIncrement"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore(); for (int i=0; i<reader.getSeriesCount(); i++) { config.setSeries(i); Time expectedIncrement = config.getTimeIncrement(); Time realIncrement = retrieve.getPixelsTimeIncrement(i); if (!isAlmostEqual(expectedIncrement,realIncrement)) { result(testName, false, "Series " + i + " (expected " + expectedIncrement + ", actual " + realIncrement + ")"); } } result(testName, true); }
@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); }
@Test(groups = {"all", "fast", "automated"}) public void testExcitationWavelengths() { if (config == null) throw new SkipException("No config tree"); String testName = "ExcitationWavelengths"; 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.getChannelExcitationWavelength(i, c); Length expectedWavelength = config.getExcitationWavelength(c); if (!isAlmostEqual(expectedWavelength,realWavelength)) { result(testName, false, "Series " + i + " channel " + c + " (expected " + expectedWavelength + ", actual " + realWavelength + ")"); } } } result(testName, true); }
String msg = null; try { MetadataRetrieve retrieve = (MetadataRetrieve) reader.getMetadataStore(); boolean success = omexmlService.isOMEXMLMetadata(retrieve); if (!success) msg = TestTools.shortClassName(retrieve);
String testName = "DeltaT"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore();
String testName = "PlanePositions"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore();
String testName = "ExposureTimes"; if (!initFile()) result(testName, false, "initFile"); IMetadata retrieve = (IMetadata) reader.getMetadataStore();
String convertedFile = tmpFile.getAbsolutePath(); IMetadata meta = (IMetadata) reader.getMetadataStore(); writer.close(); writer.setMetadataRetrieve((MetadataRetrieve) meta);