morphogen.io.xdmf

XDMF images and voxel images written slab by slab (volumes larger than memory).

An XDMF image is an XML header (.xdmf, read by ParaView and VisIt) referring to raw little-endian binary files, one per array, with the x index varying fastest. The MetaImage format (.mhd + .raw) has the same layout. voxelize_to_file() samples a microstructure slab by slab along z into a memory-mapped raw file, so that the volume never needs to fit in memory.

morphogen.io.xdmf.write_xdmf(path, images) → Path[source]

XDMF header path and one raw file per image (same grid): <stem>_<name>.raw.

morphogen.io.xdmf.read_xdmf(path, name: str | None = None) → VoxelImage[source]

Image (array name, or the first one) of an XDMF file written by morphoGen.

morphogen.io.xdmf.voxelize_to_file(micro, path, shape=None, *, voxel_size=None, labels: bool = False, slab: int | None = None, max_voxels: int = 16777216) → Path[source]

Phase (or with labels, cell label) image of a microstructure written to an .xdmf or .mhd file slab by slab along z: memory holds one slab (about max_voxels voxels, or slab layers), whatever the size of the image. The models whose images are computed pointwise give the same voxels as at once.