darsia.CoordinateSystem#
- class CoordinateSystem(img)[source]#
Bases:
objectClass for coordinate system for general space-time images.
A coordinate system has knowledge about the conversion of voxels (in standard format), i.e., ijk format with (0,0,0) being identified with the top left front corner. This implicitly concludes that the coordinate system is directly related to a certain fixed indexing, provided at initialization. Conversion maps from voxels to coordinates and vice-versa are provided.
Generate a coordinate system based on the metadata of an existing image.
- Parameters:
- img
darsia.Image Image for which a coordinate system shall be constructed.
- img
Methods
coordinate(voxel)Conversion from voxel to Cartesian coordinate, i.e., from (row,col) to (x,y) format plus scaling for a 2d image.
coordinate_vector(pixel_vector)Conversion from vectors (relative distances) in terms of pixels to coordinates.
length(num, axis)Convert number of voxels/voxels to metric units, when interpreting in some given axis.
num_voxels(length, axis)Convert length in metric units to number of voxels, when interpreting the length in some given axis.
pixel_vector(coordinate_vector)Analogue to self.coorindate_vector().
voxel(coordinate)Conversion from Cartesian coordinate to voxel in matrix indexing format.
Attributes
Coordinate array of image, collecting all coordinates.
Voxel array of image, collecting all voxels.
Indexing of the underlying image.
Dimension of the underlying space.
Dimensions of the underlying images in terms of voxels.
Physical dimensions in each index direction.
Axes of the underlying space.
Voxel size in each dimension/axis.
Extremal points/bounding box of the active coordinate system / the image.
Extremal coordinate (max) of the active coordinate system / the image.
Extremal coordinate (min) of the active coordinate system / the image.
- coordinate(voxel)[source]#
Conversion from voxel to Cartesian coordinate, i.e., from (row,col) to (x,y) format plus scaling for a 2d image.
Handles both single and multiple voxels.
- Parameters:
- voxel
np.ndarray,list,tuple,Coordinate,orVoxel Voxel location in the same format as the indexing of the underlying baseline image (see __init__); one voxel per row.
- voxel
- Returns:
np.ndarrayCorresponding coordinate in (x,y) format.
- coordinate_vector(pixel_vector)[source]#
Conversion from vectors (relative distances) in terms of pixels to coordinates.
- Parameters:
- pixel_vector
np.ndarray Vector(s) in pixel plane (one vector per row).
- pixel_vector
- Returns:
np.ndarrayCoordinate vector(s) in Cartesian format.
- length(num, axis)[source]#
Convert number of voxels/voxels to metric units, when interpreting in some given axis.
- num_voxels(length, axis)[source]#
Convert length in metric units to number of voxels, when interpreting the length in some given axis.
- voxel(coordinate)[source]#
Conversion from Cartesian coordinate to voxel in matrix indexing format.
Handles both single and multiple coordinates.
- Parameters:
- coordinate
np.ndarray,list,CoordinateorVoxel Coordinate in Cartesian format, i.e., [x,y,z]; one coordinate per row.
- coordinate
- Returns:
np.ndarrayCorresponding pixels in “ij”/”ijk” format.
- axes#
Axes of the underlying space.
- property coordinates#
Coordinate array of image, collecting all coordinates.
- Returns:
CoordinateArrayCoordinate array of image.
- dim#
Dimension of the underlying space.
- dimensions#
Physical dimensions in each index direction.
- domain#
Extremal points/bounding box of the active coordinate system / the image.
- indexing#
Indexing of the underlying image.
- max_coordinate#
Extremal coordinate (max) of the active coordinate system / the image.
- min_coordinate#
Extremal coordinate (min) of the active coordinate system / the image.
- shape#
Dimensions of the underlying images in terms of voxels.
- voxel_size#
Voxel size in each dimension/axis.
- property voxels#
Voxel array of image, collecting all voxels.
- Returns:
VoxelArrayVoxel array of image.