- bump ome-metadata dependency

- add extract-ome cli subcommand
This commit is contained in:
Wim Pomp
2026-01-04 17:03:14 +01:00
parent b1f8dd998b
commit d2c725440c
4 changed files with 43 additions and 41 deletions

View File

@@ -4,7 +4,7 @@ use ndarray::SliceInfoElem;
use ndbioimage::error::Error;
#[cfg(feature = "movie")]
use ndbioimage::movie::MovieOptions;
use ndbioimage::reader::split_path_and_series;
use ndbioimage::reader::{split_path_and_series, Reader};
#[cfg(feature = "tiff")]
use ndbioimage::tiff::TiffOptions;
use ndbioimage::view::View;
@@ -24,6 +24,11 @@ enum Commands {
#[arg(value_name = "FILE", num_args(1..))]
file: Vec<PathBuf>,
},
/// save ome metadata as xml
ExtractOME {
#[arg(value_name = "FILE", num_args(1..))]
file: Vec<PathBuf>,
},
/// Save the image as tiff file
#[cfg(feature = "tiff")]
Tiff {
@@ -113,6 +118,14 @@ pub(crate) fn main() -> Result<(), Error> {
println!("{}", view.summary()?);
}
}
Commands::ExtractOME { file } => {
for f in file {
let (path, series) = split_path_and_series(f)?;
let reader = Reader::new(&path, series.unwrap_or(0))?;
let xml = reader.get_ome_xml()?;
std::fs::write(path.with_extension("xml"), xml)?;
}
}
#[cfg(feature = "tiff")]
Commands::Tiff {
file,