Physical Images and I/O (darsia.image)#

Images are the central working objects in DarSIA. An important feature of Image objects is their physical nature. They are equipped with coordinate systems, are associates to some physical time, etc. To accomodate various common image data types several input types are supported. To enable unified data import, based image reading shall be performed using the interface functionality of imread.

Image data types#

DarSIA supports general (n+1)-dimensional images, where n denotes the spatial dimension and +1 indicates the possibility for space-time realizations of time series. Furthermore, the range of images can be both scalar and vectorial. While all images are of type Image, convenient special cases are provided for scalar images, and optical images, i.e., photographs.

Image(img[, transformations])

General image class.

ScalarImage(img[, transformations])

Special case of a space-time image, with 1d data, e.g., monochromatic photographs.

OpticalImage(img[, transformations])

Special case of 2d trichromatic optical images, typically originating from photographs.

Physical notion#

A central feature of images in DarSIA is their physical interpretation. In particular, coordinate systems providing translations between voxel and Cartesian coordinates allows for dimensionally meaningful extraction of subregions etc.

CoordinateSystem(img)

Class for coordinate system for general space-time images.

A unified interface for reading images#

Provided an image stored to file, a unified interface is provided being able to read various data formats, as jpg, png, dcm, vtu, etc.

imread(path, **kwargs)

Determine and call reading routine depending on filetype.

It is essentially a wrapper for dedicated image reading routines for specific data types - it reacts to the data ending.

imread_from_numpy(path, **kwargs)

Converter from npy format to darsia.Image.

imread_from_optical(path[, time, ...])

Reading functionality from jpg, png, tif format to optical images.

imread_from_dicom(path[, dim, transformations])

Initialization of Image by reading from DICOM format.

imread_from_vtu(path, key, shape, **kwargs)

Reading routine for data readible with meshio.

Note

Transformations can be integrated in the pre-processing and reading of images, see darsia.corrections`.

Arithmetics#

Provided a set of images, various compositions of these can be constructed.

weight(img, weight)

Scalar or element-wise weight of images.

superpose(images)

Superposition of images with possibly incompatible coordinatesystems.

stack(images)

Append images from list and create a new image.

Coordinate transformation#

Contrary to correction methods, which alter the data, coordinate transformation aim at altering the metadata. Provided two physical images with two differing relative coordinate systems, these can be aligned through transformation.

CoordinateTransformation(...[, fit_options])

General affine transformation (translation, scaling, rotation), applicable for general (up to 4d) images.

Utilities#

Various utilities are used across DarSIA, e.g., for converting matrix to Cartesian axis, extracting patches and subregions.

indexing.to_matrix_indexing(axis, indexing)

Conversion of single axis in Cartesian to matrix indexing.

indexing.to_cartesian_indexing(axis, indexing)

Conversion of single axis in matrix indexing to Cartesian indexing.

indexing.interpret_indexing(axis, indexing)

Interpretation of axes and their indexing.

indexing.matrixToCartesianIndexing(img[, dim])

Reordering data indexing converting from (row,col) to (x,y) indexing.

indexing.cartesianToMatrixIndexing(img)

Reordering data indexing, converting from (x,y) to (row,col) indexing.

patches.Patches(img, num_patches, **kwargs)

Class for patched image.

subregions.extract_quadrilateral_ROI(img_src)

Extract quadrilateral ROI using a perspective transform, given known corner points of a square (default) object.