vitrioΒΆ
vitrio is an image I/O library for Cryo-Electron Microscopy (cryo-EM and cryo-ET). This is the documentation of its Python package. The README introduces the library, the examples are programs you can run, and the C++ library has a reference of its own at ../cpp/.
import vitrio as vio
micrograph = vio.read("micrograph.mrc")
vio.write_single(micrograph, "copy.tif")
vitrio.read() is the simplest call, and the slowest way to go through
many images. Before you write a loop over files, read the
performance guide. It tells you when to use
vitrio.data, when to use the batch functions such as
vitrio.read_batch_async(), and how to set them up for your storage.
Wherever a function takes an array, it takes anything that shares host
memory through DLPack or the buffer protocol: a NumPy array, a PyTorch or
JAX tensor, a memoryview. The memory is read or written in place and
nothing is copied. A read returns a vitrio.Array, which those
libraries use in turn.
The functions that end in _async return before the work is done, with a
vitrio.Completion to wait on. Anything that reads, writes or waits
releases the GIL meanwhile.