- various fixes
This commit is contained in:
+19
-26
@@ -4,15 +4,14 @@ use crate::error::Error;
|
||||
use crate::metadata::Metadata;
|
||||
use crate::readers::{DynReader, PixelType, Reader};
|
||||
use crate::stats::MinMax;
|
||||
use crate::utils::progress::get_bar;
|
||||
use crate::view::{Number, View};
|
||||
use console::Term;
|
||||
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle};
|
||||
use indicatif::ProgressBar;
|
||||
use itertools::iproduct;
|
||||
use ndarray::{Array0, Array1, Array2, ArrayD, Dimension};
|
||||
use rayon::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
use std::time::Duration;
|
||||
use tiffwrite::{Bytes, Colors, Compression, IJTiffFile};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -34,23 +33,6 @@ impl Default for TiffOptions {
|
||||
}
|
||||
}
|
||||
|
||||
/// a progress bar with an ok style that when py::detach is used also works in jupyter
|
||||
pub fn get_bar(count: Option<usize>, message: Option<String>) -> ProgressBar {
|
||||
let style = ProgressStyle::with_template(
|
||||
"{spinner:.green} {percent}% [{wide_bar:.green/lime}] {pos:>7}/{len:7} [{elapsed}/{eta}, {per_sec:<5}]",
|
||||
).expect("template should be working").progress_chars("#>-");
|
||||
let bar = ProgressBar::with_draw_target(
|
||||
count.map(|i| i as u64),
|
||||
ProgressDrawTarget::term_like_with_hz(Box::new(Term::buffered_stdout()), 20),
|
||||
)
|
||||
.with_style(style);
|
||||
if let Some(message) = message {
|
||||
bar.set_message(message);
|
||||
}
|
||||
bar.enable_steady_tick(Duration::from_millis(100));
|
||||
bar
|
||||
}
|
||||
|
||||
impl TiffOptions {
|
||||
pub fn new(
|
||||
bar: Option<ProgressBar>,
|
||||
@@ -258,14 +240,25 @@ mod tests {
|
||||
use std::fs::create_dir_all;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[cfg(any(
|
||||
feature = "czi",
|
||||
feature = "tiffseq",
|
||||
feature = "tiff",
|
||||
feature = "bioformats_java"
|
||||
))]
|
||||
#[test]
|
||||
fn tiff() -> Result<(), Error> {
|
||||
#[cfg(any(feature = "czi", feature = "bioformats_java"))]
|
||||
let file = "czi/1xp53-01-AP1.czi";
|
||||
#[cfg(feature = "tiff")]
|
||||
let file = "tiff/20251014_20-Pos_000_000_loc_results_Cy3.tif";
|
||||
#[cfg(feature = "tiffseq")]
|
||||
let file = "tiffseq/20-Pos_005_005";
|
||||
let file = if cfg!(any(feature = "czi", feature = "bioformats_java")) {
|
||||
"czi/1xp53-01-AP1.czi"
|
||||
} else if cfg!(feature = "tiff") {
|
||||
"tiff/20251014_20-Pos_000_000_loc_results_Cy3.tif"
|
||||
} else if cfg!(feature = "tiffseq") {
|
||||
"tiffseq/20-Pos_005_005"
|
||||
} else {
|
||||
unreachable!(
|
||||
"need to enable one of these features: czi, bioformats_java, tiff, tiffseq"
|
||||
);
|
||||
};
|
||||
let path = std::env::current_dir()?
|
||||
.join("tests")
|
||||
.join("files")
|
||||
|
||||
Reference in New Issue
Block a user