- small cosmetic changes
This commit is contained in:
+4
-3
@@ -22,8 +22,9 @@ crate-type = ["cdylib", "rlib"]
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
color-eyre = { version = "0.6", 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 }
|
||||
#ffmpreg = { version = "0.1", optional = true }
|
||||
itertools = "0.15"
|
||||
indexmap = { version = "2", features = ["serde"] }
|
||||
indicatif = { version = "0.18", features = ["rayon"], optional = true }
|
||||
@@ -63,7 +64,7 @@ retry = "2"
|
||||
toml = "1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["bioformats_java", "gpl-formats", "czi", "tiff", "tiffseq", "movie", "tiffwrite"]
|
||||
all = ["bioformats_java", "bioformats_rust", "czi", "gpl-formats", "movie", "tiffseq", "tiffwrite", "tiff"]
|
||||
gpl-formats = []
|
||||
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"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["bioformats", "gpl-formats", "czi", "tiff", "movie"]
|
||||
features = ["bioformats_java", "gpl-formats", "czi", "tiff", "movie"]
|
||||
|
||||
[profile.test]
|
||||
inherits = "release"
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ ndbioimage_generate_stub = "ndbioimage:ndbioimage_generate_stub"
|
||||
|
||||
[tool.maturin]
|
||||
python-source = "py"
|
||||
features = ["python", "bioformats_java", "tiffwrite", "czi"]
|
||||
features = ["python", "default"]
|
||||
module-name = "ndbioimage.ndbioimage_rs"
|
||||
include = ["py/ndbioimage/jassets/j4rs*", "py/ndbioimage/deps/libj4rs*"]
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use pyo3_stub_gen::{StubGenConfig, StubInfo};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
use std::error::Error as StdError;
|
||||
use std::fmt::Debug;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn format_error_chain(err: &crate::error::Error) -> String {
|
||||
|
||||
@@ -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()
|
||||
&& path.is_file()
|
||||
&& (["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() {
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -495,7 +495,7 @@ impl Reader for BioFormatsJavaReader {
|
||||
let mut path = path.as_ref().to_path_buf();
|
||||
if path.is_dir() {
|
||||
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())
|
||||
})?;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ impl Reader for BioFormatsJavaReader {
|
||||
let mut path = path.as_ref().to_path_buf();
|
||||
if path.is_dir() {
|
||||
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())
|
||||
})?;
|
||||
}
|
||||
|
||||
+2
-2
@@ -795,7 +795,7 @@ impl Reader for CziReader {
|
||||
.get_child("Wavelength")
|
||||
.and_then(|w| w.get_text())
|
||||
.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,
|
||||
})
|
||||
} else if let Version::Other = version {
|
||||
@@ -876,7 +876,7 @@ impl Reader for CziReader {
|
||||
.get_child("EmissionWaveLength")
|
||||
.and_then(|e| e.get_text())
|
||||
.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,
|
||||
excitation_wavelength: light_source_settings
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user