rockverse.voxel_image.VoxelImage#

class rockverse.voxel_image.VoxelImage(z)[source]#

The basic type for RockVerse Digital Rock Petrophysics, intended to contain voxelized 3D images and scalar fields in general. The class builds upon Zarr arrays by adding attributes and methods specifically designed for digital rock petrophysics in a high performance parallel computing environment.

Note

This class should not be instantiated directly. Instead, use the provided creation functions.

Attributes#

dtype

The image data type.

description

General image or scalar field description.

field_name

Name for the stored scalar field.

field_unit

Unit for the stored scalar field.

nx

The number of voxels in x-direction (first axis).

ny

The number of voxels in y-direction (second axis).

nz

The number of voxels in z-direction (third axis).

shape

The image shape.

ox

Spatial x-coordinate for the first voxel in x-direction (first axis).

oy

Spatial y-coordinate for the first voxel in y-direction (second axis).

oz

Spatial z-coordinate for the first voxel in z-direction (third axis).

voxel_origin

Image voxel origin for each direction.

hx

Voxel length in x-direction (first axis).

hy

Voxel length in y-direction (second axis).

hz

Voxel length in z-direction (third axis).

voxel_length

Returns the image voxel length in each spatial direction (x, y, z) as a tuple.

h_unit

Image voxel unit.

voxel_unit

Image voxel unit.

dimensions

Image total dimension in each direction.

bounding_box

Image bounding box in voxel units.

meta_data_as_dict

Return voxel image meta data as a dictionary.

ndim

The image number of dimensions.

chunks

The image chunk shape.

nchunks

The image number of chunks.

zarray

The underlying Zarr array object.

Basic methods#

chunk_slice_indices(chunk_id[, return_indices])

Calculate the slice indices for a given Zarr chunk.

get_voxel_coordinates(i, j, k)

Get the spatial coordinates of the voxel at a given position.

get_closest_voxel_index(x, y, z[, allow_outside])

Get the voxel index closest to a given spatial position.

check_mask_and_segmentation(*[, mask, ...])

Validate mask and segmentation compatibility.

create_mask_from_region(region, **kwargs)

Create a mask voxel image.

Parallel math#

math(value, op, *[, mask, segmentation, ...])

Element-wise math operations.

combine(image, op, *[, mask, segmentation, ...])

Combine another voxel image by element-wise math operations.

Saving to disk#

copy([store])

Copy the voxel image to a new store.

export_raw(filename[, dtype, order, ...])

Export a voxel image to a raw file and corresponding metadata to a JSON file.