- small cosmetic changes

This commit is contained in:
w.pomp
2026-07-22 13:40:27 +02:00
parent 0d347b7967
commit a5ec4125f9
5 changed files with 13 additions and 11 deletions
+4 -3
View File
@@ -22,8 +22,9 @@ crate-type = ["cdylib", "rlib"]
clap = { version = "4", features = ["derive"] } clap = { version = "4", features = ["derive"] }
color-eyre = { version = "0.6", optional = true } color-eyre = { version = "0.6", optional = true }
console = { version = "0.16", optional = true } console = { version = "0.16", optional = true }
downloader = { version = "0.2", optional = true } downloader = { version = "0.2", optional = true, default-features = false, features = ["rustls-tls"] }
ffmpeg-sidecar = { version = "2", optional = true } ffmpeg-sidecar = { version = "2", optional = true }
#ffmpreg = { version = "0.1", optional = true }
itertools = "0.15" itertools = "0.15"
indexmap = { version = "2", features = ["serde"] } indexmap = { version = "2", features = ["serde"] }
indicatif = { version = "0.18", features = ["rayon"], optional = true } indicatif = { version = "0.18", features = ["rayon"], optional = true }
@@ -63,7 +64,7 @@ retry = "2"
toml = "1" toml = "1"
[features] [features]
default = [] default = ["bioformats_java", "gpl-formats", "czi", "tiff", "tiffseq", "movie", "tiffwrite"]
all = ["bioformats_java", "bioformats_rust", "czi", "gpl-formats", "movie", "tiffseq", "tiffwrite", "tiff"] all = ["bioformats_java", "bioformats_rust", "czi", "gpl-formats", "movie", "tiffseq", "tiffwrite", "tiff"]
gpl-formats = [] gpl-formats = []
python = ["dep:pyo3", "dep:numpy", "dep:color-eyre", "dep:pyo3-stub-gen", "dep:postcard", "ome-metadata/python"] python = ["dep:pyo3", "dep:numpy", "dep:color-eyre", "dep:pyo3-stub-gen", "dep:postcard", "ome-metadata/python"]
@@ -76,7 +77,7 @@ tiff = ["dep:tiff", "dep:thread_local"]
movie = ["dep:ffmpeg-sidecar", "dep:tokio", "dep:ordered-float", "dep:indicatif", "dep:console"] movie = ["dep:ffmpeg-sidecar", "dep:tokio", "dep:ordered-float", "dep:indicatif", "dep:console"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["bioformats", "gpl-formats", "czi", "tiff", "movie"] features = ["bioformats_java", "gpl-formats", "czi", "tiff", "movie"]
[profile.test] [profile.test]
inherits = "release" inherits = "release"
+1 -1
View File
@@ -35,7 +35,7 @@ ndbioimage_generate_stub = "ndbioimage:ndbioimage_generate_stub"
[tool.maturin] [tool.maturin]
python-source = "py" python-source = "py"
features = ["python", "bioformats_java", "tiffwrite", "czi"] features = ["python", "default"]
module-name = "ndbioimage.ndbioimage_rs" module-name = "ndbioimage.ndbioimage_rs"
include = ["py/ndbioimage/jassets/j4rs*", "py/ndbioimage/deps/libj4rs*"] include = ["py/ndbioimage/jassets/j4rs*", "py/ndbioimage/deps/libj4rs*"]
+1
View File
@@ -27,6 +27,7 @@ use pyo3_stub_gen::{StubGenConfig, StubInfo};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashSet; use std::collections::HashSet;
use std::error::Error as StdError; use std::error::Error as StdError;
use std::fmt::Debug;
use std::path::PathBuf; use std::path::PathBuf;
fn format_error_chain(err: &crate::error::Error) -> String { fn format_error_chain(err: &crate::error::Error) -> String {
+5 -5
View File
@@ -470,15 +470,15 @@ impl Drop for BioFormatsJavaReader {
} }
} }
fn find_tiff(path: PathBuf) -> Result<Option<PathBuf>, Error> { fn find_tiff(path: &Path) -> Result<Option<PathBuf>, Error> {
if let Some(ext) = path.extension() if let Some(ext) = path.extension()
&& path.is_file() && path.is_file()
&& (["tif", "tiff"].contains(&ext.to_string_lossy().to_lowercase().as_str())) && (["tif", "tiff"].contains(&ext.to_string_lossy().to_lowercase().as_str()))
{ {
return Ok(Some(path)); return Ok(Some(path.to_path_buf()));
} else if path.is_dir() { } else if path.is_dir() {
for file in path.read_dir()?.flatten().sorted_by_key(|i| i.file_name()) { for file in path.read_dir()?.flatten().sorted_by_key(|i| i.file_name()) {
if let Ok(Some(file)) = find_tiff(file.path()) { if let Ok(Some(file)) = find_tiff(file.path().as_path()) {
return Ok(Some(file)); return Ok(Some(file));
} }
} }
@@ -495,7 +495,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf(); let mut path = path.as_ref().to_path_buf();
if path.is_dir() { if path.is_dir() {
let orig = path.clone(); let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| { path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string()) Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?; })?;
} }
@@ -572,7 +572,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf(); let mut path = path.as_ref().to_path_buf();
if path.is_dir() { if path.is_dir() {
let orig = path.clone(); let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| { path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string()) Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?; })?;
} }
+2 -2
View File
@@ -795,7 +795,7 @@ impl Reader for CziReader {
.get_child("Wavelength") .get_child("Wavelength")
.and_then(|w| w.get_text()) .and_then(|w| w.get_text())
.and_then(|t| t.parse().ok()) .and_then(|t| t.parse().ok())
.and_then(|w| if w > 0.0 { Some(w) } else { None }), .filter(|&w| w > 0.0),
wavelength_unit: ome::UnitsLength::nm, wavelength_unit: ome::UnitsLength::nm,
}) })
} else if let Version::Other = version { } else if let Version::Other = version {
@@ -876,7 +876,7 @@ impl Reader for CziReader {
.get_child("EmissionWaveLength") .get_child("EmissionWaveLength")
.and_then(|e| e.get_text()) .and_then(|e| e.get_text())
.and_then(|t| t.parse().ok()) .and_then(|t| t.parse().ok())
.and_then(|w| if w > 0.0 { Some(w) } else { None }), .filter(|&w| w > 0.0),
emission_wavelength_unit: ome::UnitsLength::nm, emission_wavelength_unit: ome::UnitsLength::nm,
excitation_wavelength: light_source_settings excitation_wavelength: light_source_settings
.as_ref() .as_ref()