commit b5e583f760f4384ba0b14ef5f012b20411c746d5 Author: Wim Pomp Date: Mon Apr 28 20:31:35 2025 +0200 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f11ec9 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# ome-metadata + +Open Microscopy XML metadata (https://www.openmicroscopy.org/Schemas/) as a collection of Rust structs and enums, with translation to Python. + +## Rust +``` +use std::fs::read_to_string; +use ome_metadata::Ome; + +let xml = read_to_string($file)?; +let ome: Ome = xml.parse()?; +let image = &ome.image.unwrap()[0]; +println!("acquisition date: {:#?}", image.acquisition_date); +``` + +## Python +``` +from ome_metadata import Ome + +with open($file) as f: + xml = f.read() +ome = Ome.from_xml(xml) +image = ome.image[0] +print(f"acquisition date: {image.acquisition_date}") +``` \ No newline at end of file