The image data model#
Everything in DarSIA revolves around Image: an array of pixel values
that also knows what it represents physically – its extent in metres, its
acquisition time, whether it is a scalar field or an RGB photograph, and how its
voxel indices map to Cartesian coordinates.
Image types#
the general |
|
convenience subclass for single-channel data (concentrations, saturations, depth maps) |
|
convenience subclass for photographs, with
colour-space awareness ( |
Constructing an image#
Most images enter DarSIA through imread() (see Reading images), but
you can also wrap a NumPy array directly:
import numpy as np
import darsia
arr = np.random.rand(200, 300)
image = darsia.ScalarImage(arr, width=0.3, height=0.2, dim=2)
image.show() # quick matplotlib view
sub = image.subregion(darsia.make_coordinate([[0.05, 0.05], [0.2, 0.15]]))
print(image.metadata())
Key ideas#
Physical size, not pixels.
width/height(ordimensions) give the domain its real extent; regions, patches and ROIs are then addressed in metres.Time series. An image can carry a time axis;
image.time_slice(i)pulls out one frame,image.time_numcounts them.Metadata travels with the data. Corrections that only change geometry update the metadata; corrections that change pixels do not (see Corrections).
Arithmetic.
weight(),superpose()andstack()combine images while keeping their physical meaning consistent.
See also#
Coordinate systems – voxel/Cartesian conversion and patches
A first DarSIA image – a worked first example
Images & coordinates – full API