single_cell_parser
❭ scalar_field
❭ ScalarField
ScalarField¶
-
class single_cell_parser.scalar_field.ScalarField(mesh=
None
, origin=()
, extent=()
, spacing=()
, bBox=()
)¶ 3D scalar fields based on numpy arrays
A convenience class around numpy array for 3D scalar fields. The class provides methods to access scalar values at arbitrary 3D coordinates, to get the bounding box of a voxel, and to get the center of a voxel.
This class is used for e.g. assigning sub-cellular synapse distributions modeled after vtkImageData, i.e. a regular mesh.
- Parameters:¶
mesh (numpy.ndarray) – 3D numpy array representing the scalar field.
origin (tuple) – 3-tuple of floats representing the origin of the scalar field.
extent (tuple) – 6-tuple of integers representing the extent of the scalar field.
spacing (tuple) – 3-tuple of floats representing the spacing of the scalar field.
bBox (tuple) – 6-tuple of floats representing the bounding box of the scalar field.
- Attributes:¶
- extent¶
6-tuple of integers representing the extent of the scalar field. Note that the extent always starts at 0: Format: (0, xmax - xmin, 0, ymax - ymin, 0, zmax - zmin)
- Type:¶
tuple
- spacing¶
3-tuple of floats representing the spacing of the scalar field. If all values are equal, the scalar field has cubic voxels.
- Type:¶
tuple
- boundingBox¶
6-tuple of floats representing the bounding box of the scalar field. Format: (xmin, xmax, ymin, ymax, zmin, zmax)
- Type:¶
tuple
- Methods:¶
Resizes mesh to non-zero scalar data.
get_scalar
(xyz)Fetch the scalar value of the voxel containing the point xyz.
is_in_bounds
(xyz)Check if point is within bounding box of mesh.
get_mesh_coordinates
(xyz)Fetch the mesh index of the voxel containing the point xyz.
get_voxel_bounds
(ijk)Gets the bounding box of voxel given by indices i,j,k.
get_voxel_center
(ijk)Fetch the center of the voxel given by indices i,j,k.