rewrite in rust

This commit is contained in:
Wim Pomp
2024-10-06 20:30:57 +02:00
parent 93d62c5345
commit 82931f7715
8 changed files with 1339 additions and 636 deletions

28
src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
#[cfg(not(feature = "nopython"))]
mod py;
mod lib;
use anyhow::Result;
use ndarray::{s, Array2};
use rayon::prelude::*;
use crate::lib::IJTiffFile;
fn main() -> Result<()> {
println!("Hello World!");
let mut f = IJTiffFile::new("foo.tif", (1, 2, 1))?;
let mut arr = Array2::<u16>::zeros((100, 100));
// for i in 0..arr.shape()[0] {
// for j in 0..arr.shape()[1] {
// arr[[i, j]] = i as u16;
// }
// }
f.save(arr.to_owned(), 0, 0, 0, None)?;
// let mut arr = Array2::<u16>::zeros((100, 100));
// arr.slice_mut(s![64.., ..64]).fill(1);
// arr.slice_mut(s![..64, 64..]).fill(2);
// arr.slice_mut(s![64.., 64..]).fill(3);
f.save(arr.to_owned(), 0, 1,0, None)?;
Ok(())
}