Hi Heg,
An additional comment. When I create an ome.tif the objective metadata in omero.insight gets correctly populated. Using the same program I creata a .ome and only the manufacturer and model gets populated.
I wrote some code to test the Objective and ObjectiveSettings population, and was unable to duplicate this issue. Everything seems to work fine when writing to either OME-XML or OME-TIFF, using the latest trunk build of Bio-Formats. Try the code below, and let me know if either out.ome or out.ome.tif get produced with missing metadata.
Or did I misunderstand your comment?
- Code: Select all
import loci.formats.*;
import loci.formats.meta.*;
public class WriteObjectiveInfo {
public static void main(String[] args) throws Exception {
IMetadata meta = MetadataTools.createOMEXMLMetadata();
meta.createRoot();
int w = 10, h = 10;
meta.setPixelsSizeX(new Integer(w), 0, 0);
meta.setPixelsSizeY(new Integer(h), 0, 0);
meta.setPixelsSizeZ(new Integer(1), 0, 0);
meta.setPixelsSizeC(new Integer(1), 0, 0);
meta.setPixelsSizeT(new Integer(1), 0, 0);
meta.setPixelsBigEndian(Boolean.TRUE, 0, 0);
meta.setPixelsDimensionOrder("XYZCT", 0, 0);
meta.setPixelsPixelType(
FormatTools.getPixelTypeString(FormatTools.UINT8), 0, 0);
meta.setObjectiveCalibratedMagnification(new Float(10.00124f), 0, 0);
meta.setObjectiveCorrection("UV", 0, 0);
meta.setObjectiveImmersion("Oil", 0, 0);
meta.setObjectiveIris(Boolean.TRUE, 0, 0);
meta.setObjectiveLensNA(new Float(2.1f), 0, 0);
meta.setObjectiveManufacturer("Manufacturer!", 0, 0);
meta.setObjectiveModel("Model!", 0, 0);
meta.setObjectiveNominalMagnification(new Integer(10), 0, 0);
meta.setObjectiveSerialNumber("SerialNumber!", 0, 0);
meta.setObjectiveWorkingDistance(new Float(9.2f), 0, 0);
meta.setObjectiveSettingsCorrectionCollar(new Float(3.4f), 0);
meta.setObjectiveSettingsMedium("Water", 0);
String objectiveID = meta.getObjectiveID(0, 0);
meta.setObjectiveSettingsObjective(objectiveID, 0);
meta.setObjectiveSettingsRefractiveIndex(new Float(7.8f), 0);
IFormatWriter writer = new ImageWriter();
writer.setMetadataRetrieve(meta);
byte[] bytes = new byte[w * h];
writer.setId("out.ome");
writer.saveBytes(bytes, true);
writer.close();
writer.setId("out.ome.tif");
writer.saveBytes(bytes, true);
writer.close();
}
}