darsia.ScalarImage#

class ScalarImage(img, transformations=None, **kwargs)[source]#

Bases: Image

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

Specialized constructor for optical images.

In addition to the constructor of general images, the color space is required to be specified through the keyword arguments.

Methods

append(image[, offset])

Append other image to current image.

astype(data_type)

For scalar data types, change the data type of the data array.

copy()

Copy constructor.

eval(point[, interpolation])

Evaluate the image array at a given point location.

geometry()

Generate (flat) geometry object corresponding to the image.

img_as(data_type)

Change data type via skimage.

integral()

Integrate the image over its spatial dimensions.

metadata()

Return all metadata required to initiate an image via keyword arguments.

reset_origin([return_image])

Reset origin and coordinatesystem.

reset_reference_time()

Pick date of first image in a series as reference date.

resize(cx[, cy])

roi(roi)

Extraction of spatial subregion using a darsia.ROI object.

save(path[, verbose])

Save image to file.

set_time([time])

Setter for time array.

shape_metadata()

Return all metadata connected to dimensions of image and voxels.

show([title, duration, mode])

Show image using matplotlib.pyplots or plotly built-in methods.

show_matplotlib([title, duration])

Show the image using matplotlib.pyplot.

show_plain([title])

Show image using matplotlib.pyplots in plain mode.

show_plotly([title, duration])

Show the image using plotly (often faster than matplotlib).

slice(cut, axis)

Extract of spatial slice.

subregion(roi)

Extraction of spatial subregion.

time_interval(indices)

Extraction of temporal subregion, only for space-time images.

time_slice(time_index)

Extraction of single time slice.

to_csv(path, *[, delimiter, header, ...])

Write scalar image cell-center data to CSV file.

to_vtk(path[, name])

Save image to file in vtk format.

update_metadata([meta])

Update metadata of image.

update_reference_time(reference)

Update reference time.

write(path, **kwargs)

Write the image to file.

Attributes

coordinatesystem

Physical coordinate system with equipped transformation from voxel to Cartesian space.

domain

Physical domain.

dtype

Data type of the (current) image array.

num_voxels

Number of voxels in each dimension.

opposite_corner

Cartesian coordinate of the corner opposite to origin.

shape

Shape of the image array, incl.

space_num

Spatial resolution, i.e., number of voxels.

voxel_size

Size of each voxel in each direction, ordered as indexing.

img

Data array.

original_dtype

Original dtype at construction of the object.

space_dim

Dimension of the spatial domain.

indexing

Indexing of each axis in context of matrix indexing (ijk) or Cartesian coordinates (xyz).

dimensions

Dimension in the directions corresponding to the indexings.

name

Name of image, e.g., used to describe the origin.

origin

Cartesian coordinates associated to the [0,0,0] voxel (after applying transformations), using Cartesian indexing.

series

Flag controlling whether the data array corresponds to a time series.

time_dim

Dimensionality of the image in temporal sense.

time_num

Number of time points.

date

Time in datetime format.

reference_date

Reference date (for defining relative time).

time

Relative time in scalar format (in seconds).

scalar

Flag controlling whether the data array is scalar, i.e., it does not use an extra axis to encode the range.

range_dim

Dimensionality of the image in data sense.

range_num

Number of entries for each data entry.

copy()[source]#

Copy constructor.

Returns:
ScalarImage

Copy of the image object.

to_csv(path, *, delimiter=',', header=None, float_format='{:.2e}')[source]#

Write scalar image cell-center data to CSV file.

Parameters:
pathPath

Target CSV path.

delimiterstr

Delimiter used between values.

headerstr | None

Optional header line. None or "none" disables header.

float_formatstr

Float formatting string.

write(path, **kwargs)[source]#

Write the image to file.

Parameters:
pathPath

Full path to the output image.

**kwargs

Format options:

quality (int)      0-100, resolution for a jpg image
compression (int)  0-9, compression level for a png image
cmap (str)         colour map used when storing the image