@@ -0,0 +1,2473 @@
+/*%0A * #%25L%0A * SCIFIO Bio-Formats compatibility format.%0A * %25%25%0A * Copyright (C) 2013 Open Microscopy Environment:%0A *   - Board of Regents of the University of Wisconsin-Madison%0A *   - Glencoe Software, Inc.%0A *   - University of Dundee%0A * %25%25%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as%0A * published by the Free Software Foundation, either version 2 of the %0A * License, or (at your option) any later version.%0A * %0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A * %0A * You should have received a copy of the GNU General Public %0A * License along with this program.  If not, see%0A * %3Chttp://www.gnu.org/licenses/gpl-2.0.html%3E.%0A * #L%25%0A */%0A%0Apackage io.scif.ome;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport io.scif.FormatException;%0Aimport io.scif.Metadata;%0Aimport io.scif.SCIFIO;%0Aimport io.scif.ome.xml.meta.OMEMetadata;%0A%0Aimport java.io.IOException;%0A%0Aimport net.imglib2.meta.Axes;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * Unit tests to ensure calibration values are preserved properly when%0A * translating to/from the OME classes.%0A * %0A * @author Mark Hiner%0A */%0Apublic class CalibrationTest %7B%0A%0A%09private final SCIFIO scifio = new SCIFIO();%0A%09private String id = %22testImg&sizeX=512&sizeY=512.fake%22;%0A%0A%09// Try setting calibration values, translate to OMEMetadata and%0A%09// verify they persisted%0A%09@Test%0A%09public void testTranslateToOME() throws IOException, FormatException %7B%0A%09%09// Parse source metadata%0A%09%09Metadata meta = scifio.initializer().parseMetadata(id);%0A%0A%09%09// Adjust calibration%0A%09%09meta.getAxis(0, Axes.X).setCalibration(5.0);%0A%09%09meta.getAxis(0, Axes.Y).setCalibration(6.0);%0A%09%09meta.getAxis(0, Axes.Z).setCalibration(7.0);%0A%09%09meta.getAxis(0, Axes.TIME).setCalibration(8.0);%0A%0A%09%09OMEMetadata omeMeta = new OMEMetadata(scifio.getContext());%0A%0A%09%09// Translate to OMEMetadata%0A%09%09scifio.translator().translate(meta, omeMeta, false);%0A%0A%09%09// Verify results%0A%09%09assertEquals(omeMeta.getRoot().getPixelsPhysicalSizeX(0).getValue(),%0A%09%09%09new Double(5.0));%0A%09%09assertEquals(omeMeta.getRoot().getPixelsPhysicalSizeY(0).getValue(),%0A%09%09%09new Double(6.0));%0A%09%09assertEquals(omeMeta.getRoot().getPixelsPhysicalSizeZ(0).getValue(),%0A%09%09%09new Double(7.0));%0A%09%09assertEquals(omeMeta.getRoot().getPixelsTimeIncrement(0),%0A%09%09%09new Double(8.0));%0A%09%7D%0A%09%0A%7D%0A

Create CalibrationTest class