- bump dependencies
- bump git action versions
This commit is contained in:
+5
-6
@@ -1,14 +1,13 @@
|
||||
use thiserror::Error;
|
||||
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error("io error: {0}")]
|
||||
#[error(transparent)]
|
||||
IO(#[from] std::io::Error),
|
||||
#[error(transparent)]
|
||||
ColorCet(#[from] colorcet::ColorcetError),
|
||||
#[error("could not parse color: {0}")]
|
||||
ColorParse(String),
|
||||
#[error("colorcet error: {0}")]
|
||||
ColorCet(#[from] colorcet::ColorcetError),
|
||||
#[error("could not covert ColorMap into LinearGradient")]
|
||||
Conversion
|
||||
}
|
||||
Conversion,
|
||||
}
|
||||
|
||||
+18
-5
@@ -1,7 +1,8 @@
|
||||
pub mod error;
|
||||
#[cfg(feature = "python")]
|
||||
mod py;
|
||||
pub mod error;
|
||||
|
||||
use crate::error::Error;
|
||||
use chrono::Utc;
|
||||
use colorcet::ColorMap;
|
||||
use colorgrad::{Gradient, LinearGradient};
|
||||
@@ -23,7 +24,6 @@ use std::{
|
||||
};
|
||||
use zstd::zstd_safe::CompressionLevel;
|
||||
use zstd::{DEFAULT_COMPRESSION_LEVEL, stream::Encoder};
|
||||
use crate::error::Error;
|
||||
|
||||
const TAG_SIZE: usize = 20;
|
||||
const OFFSET_SIZE: usize = 8;
|
||||
@@ -60,7 +60,11 @@ impl IFD {
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&mut self, ijtifffile: &mut IJTiffFile, where_to_write_offset: u64) -> Result<u64, Error> {
|
||||
fn write(
|
||||
&mut self,
|
||||
ijtifffile: &mut IJTiffFile,
|
||||
where_to_write_offset: u64,
|
||||
) -> Result<u64, Error> {
|
||||
let mut tags = self.tags.drain().collect::<Vec<_>>();
|
||||
tags.sort();
|
||||
ijtifffile.file.seek(SeekFrom::End(0))?;
|
||||
@@ -748,7 +752,10 @@ impl IJTiffFile {
|
||||
/// set colormap from named colormap (see [colorcet](https://crates.io/crates/colorcet))
|
||||
pub fn set_colormap<S: AsRef<str>>(&mut self, name: S) -> Result<(), Error> {
|
||||
let name = name.as_ref();
|
||||
let colormap: LinearGradient = name.parse::<ColorMap>()?.try_into().map_err(|_| Error::Conversion)?;
|
||||
let colormap: LinearGradient = name
|
||||
.parse::<ColorMap>()?
|
||||
.try_into()
|
||||
.map_err(|_| Error::Conversion)?;
|
||||
let mut colormap = colormap
|
||||
.colors(256)
|
||||
.into_iter()
|
||||
@@ -896,7 +903,13 @@ impl IJTiffFile {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_frame(&mut self, frame: CompressedFrame, c: usize, z: usize, t: usize) -> Result<(), Error> {
|
||||
fn write_frame(
|
||||
&mut self,
|
||||
frame: CompressedFrame,
|
||||
c: usize,
|
||||
z: usize,
|
||||
t: usize,
|
||||
) -> Result<(), Error> {
|
||||
let mut offsets = Vec::new();
|
||||
let mut bytecounts = Vec::new();
|
||||
for tile in frame.bytes {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{Colors, Compression, IJTiffFile, Tag};
|
||||
use num::{Complex, FromPrimitive, Rational32};
|
||||
use numpy::PyReadonlyArray2;
|
||||
use numpy::{AllowTypeChange, PyArrayLike2};
|
||||
use pyo3::exceptions::PyValueError;
|
||||
use pyo3::prelude::*;
|
||||
|
||||
@@ -338,7 +338,7 @@ macro_rules! impl_save {
|
||||
impl PyIJTiffFile {
|
||||
fn $t(
|
||||
&mut self,
|
||||
frame: PyReadonlyArray2<$T>,
|
||||
frame: PyArrayLike2<$T, AllowTypeChange>,
|
||||
c: usize,
|
||||
t: usize,
|
||||
z: usize,
|
||||
|
||||
Reference in New Issue
Block a user