Skip to content

Commit

Permalink
Add support for OME-Zarr 0.5-dev1
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Jul 2, 2024
1 parent e25eb92 commit ef3f4f7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `zarrs` to 0.15.0-beta.1
- Bump `rayon` to 1.10.0
- Bump `itertools` to 0.13
- `zarrs_ome`: add `--version` arg, supproting `0.5-dev` or `0.5-dev1`

## [0.4.2] - 2024-05-16

Expand Down
33 changes: 32 additions & 1 deletion src/bin/zarrs_ome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ enum OutputExists {
Exit,
}

#[allow(non_camel_case_types)]
#[derive(clap::ValueEnum, Debug, Clone)]
enum OMEZarrVersion {
/// 0.5-dev (Zarr V3 version of Editor's Draft 12 June 2024).
///
/// Supported by Neuroglancer since v2.37.
#[value(name = "0.5-dev")]
V0_5_dev,
/// 0.5-dev1 (Identical to 0.5-dev aside from the "version").
#[value(name = "0.5-dev1")]
V0_5_dev1,
}

impl std::fmt::Display for OMEZarrVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
OMEZarrVersion::V0_5_dev => write!(f, "0.5-dev"),
OMEZarrVersion::V0_5_dev1 => write!(f, "0.5-dev1"),
}
}
}

/// Convert a Zarr V3 array to OME-Zarr (0.5-dev).
#[derive(Parser, Debug)]
#[command(author, version)]
Expand All @@ -48,6 +70,10 @@ struct Cli {
/// The output group path.
output: PathBuf,

// The OME-Zarr version.
#[arg(long, default_value_t = OMEZarrVersion::V0_5_dev)]
version: OMEZarrVersion,

/// The downsample factor.
///
/// Defaults to 2 on each axis.
Expand Down Expand Up @@ -375,8 +401,13 @@ fn run() -> Result<(), Box<dyn Error>> {
repository: env!("CARGO_PKG_REPOSITORY").to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};
let version_str = match cli.version {
OMEZarrVersion::V0_5_dev => "0.5-dev",
OMEZarrVersion::V0_5_dev1 => "0.5-dev1",
};

let mut multiscales = Multiscales {
version: "0.5-dev".to_string(),
version: version_str.to_string(),
name: cli.name,
axes,
datasets: Vec::with_capacity(cli.max_levels),
Expand Down

0 comments on commit ef3f4f7

Please sign in to comment.