- bump ome-metadata dependency
- add extract-ome cli subcommand
This commit is contained in:
15
src/main.rs
15
src/main.rs
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user