
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Write BioFormats/ImageJ compatible tiffs with zstd compression in parallel using Rust.
pip install tiffwrite
or
pip install tiffwrite@git+https://github.com/wimpomp/tiffwrite
tiffwrite(file, data, axes='TZCXY', dtype=None, bar=False, *args, **kwargs)
with IJTiffFile(file, dtype='uint16', colors=None, colormap=None, pxsize=None, deltaz=None,
timeinterval=None, **extratags) as tif:
some loop:
tif.save(frame, c, z, t)
path: string; path to the new tiff file.
dtype: string; cast data to dtype before saving, only (u)int8, (u)int16 and float32 are supported by Fiji.
colors: iterable of strings; one color per channel, valid colors (also html) are defined in matplotlib.colors. Without colormap BioFormats will set the colors in this order: rgbwcmy. Note that the color green is dark, the usual green is named 'lime' here.
colormap: string; choose any colormap from the colorcet module. Colors and colormap cannot be used simultaneously.
pxsize: float; pixel size im um.
deltaz: float; z slice interval in um.
timeinterval: float; time between frames in seconds.
compression: int; zstd compression level: -7 to 22.
comment: str; comment to be saved in tif
extratags: Sequence[Tag]; other tags to be saved, example: Tag.ascii(315, 'John Doe') or Tag.ascii(33432, 'Made by me').
frame: 2D numpy array with data.
c, z, t: int; channel, z, time coordinates of the frame.
from tiffwrite import tiffwrite
import numpy as np
image = np.random.randint(0, 255, (5, 3, 64, 64), 'uint16')
tiffwrite('file.tif', image, 'TCXY')
from tiffwrite import IJTiffFile
import numpy as np
with IJTiffFile('file.tif', pxsize=0.09707) as tif:
for c in range(3):
for z in range(5):
for t in range(10):
tif.save(np.random.randint(0, 10, (32, 32)), c, z, t)
from tiffwrite import IJTiffFile
import numpy as np
with IJTiffFile('fileA.tif') as tif_a, IJTiffFile('fileB.tif') as tif_b:
for c in range(3):
for z in range(5):
for t in range(10):
tif_a.save(np.random.randint(0, 10, (32, 32)), c, z, t)
tif_b.save(np.random.randint(0, 10, (32, 32)), c, z, t)
use ndarray::Array2;
use tiffwrite::IJTiffFile;
{ // f will be closed when f goes out of scope
let mut f = IJTiffFile::new("file.tif")?;
for c in 0..3 {
for z in 0..5 {
for t in 0..10 {
let arr = Array2::<u16>::zeros((100, 100));
f.save(&arr, c, z, t)?;
}
}
}
}
FAQs
Write BioFormats/ImageJ compatible tiffs with zstd compression in parallel.
We found that tiffwrite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.