tyssue.generation package#
Submodules#
tyssue.generation.from_voronoi module#
- tyssue.generation.from_voronoi.from_2d_voronoi(voro, specs=None)[source]#
Creates 2D (sheet geometry) datasets from a Voronoï tessalation
- Parameters
voro (a
scipy.spatial.Voronoi
object) –- Returns
datasets – datasets suitable for
Epithelium
implementation- Return type
dict
- tyssue.generation.from_voronoi.from_3d_voronoi(voro)[source]#
Creates 3D (bulk geometry) datasets from a Voronoï tessalation
- Parameters
voro (a
scipy.spatial.Voronoi
object) –- Returns
datasets – datasets suitable for
Epithelium
implementation- Return type
dict
Notes
It is important to reset the index of the created epithelium after creation
Example
cells = hexa_grid3d(3, 3, 3) datasets = from_3d_voronoi(Voronoi(cells)) bulk = Epithelium(‘bulk’, datasets) bulk.reset_topo() bulk.reset_index(order=True) bulk.sanitize()
tyssue.generation.hexagonal_grids module#
Hexagonal grids#
- tyssue.generation.hexagonal_grids.circle(num_t, radius=1.0, phase=0.0)[source]#
Returns x and y positions of num_t points regularly placed around a circle of radius radius, shifted by phase radians.
- Parameters
num_t (int) – the number of points around the circle
radius (float, default 1.) – the radius of the circle
phase (float, default 0.0) – angle shift w/r to the x axis in radians
- Returns
points
- Return type
np.Ndarray of shape (num_t, 2), the x, y positions of the points
- tyssue.generation.hexagonal_grids.hexa_cylinder(num_t, num_z, radius=1.0, capped=False, noise=0, orientation='transverse')[source]#
Returns an arrays of x, y positions of points evenly spread on a cylinder with num_t points on the periphery and num_z points on its length.
- Parameters
num_t (int,) – The number of points on the periphery
num_z (int,) – The number of points along the z axis (the length of the cylinder)
radius (float, default 1) – The radius of the cylinder
capped (bool, default False) – If True, the tips of the cylinder are capped by a disk of point as generated by the hexa_disk function.
noise (float, default 0) – normaly distributed position noise around the cell points
orientation ({'transverse' | 'longitudinal'}, default 'transverse') – the orientation of the cells (with the longueur axis perpendicular or along the length of the cylinder)
- tyssue.generation.hexagonal_grids.hexa_disk(num_t, radius=1)[source]#
Returns an arrays of x, y positions of points evenly spread on a disk with num_t points on the periphery.
- Parameters
num_t (int) – the number of poitns on the disk periphery, the rest of the disk is filled automaticaly
radius (float, default 1.) – the radius of the disk
- tyssue.generation.hexagonal_grids.hexa_grid2d(nx, ny, distx, disty, noise=None)[source]#
Creates an hexagonal grid of points
- tyssue.generation.hexagonal_grids.hexa_grid3d(nx, ny, nz, distx=1.0, disty=1.0, distz=1.0, noise=None)[source]#
Creates an hexagonal grid of points
- tyssue.generation.hexagonal_grids.three_faces_sheet(zaxis=True)[source]#
Creates the apical junctions mesh of three packed hexagonal faces. If zaxis is True (defaults to False), adds a z coordinates, with z = 0.
Faces have a side length of 1.0 +/- 1e-3.
- Returns
face_df (the faces DataFrame indexed from 0 to 2)
vert_df (the junction vertices DataFrame)
edge_df (the junction edges DataFrame)
- tyssue.generation.hexagonal_grids.three_faces_sheet_array()[source]#
Creates the apical junctions mesh of three packed hexagonal faces. If zaxis is True (defaults to False), adds a z coordinates, with z = 0.
Faces have a side length of 1.0 +/- 1e-3.
- Returns
points ((13, ndim) np.array of floats) – the positions, where ndim is 2 or 3 depending on zaxis
edges ((15, 2) np.array of ints) – indices of the edges
(Nc, Nv, Ne) (triple of ints) – number of faces, vertices and edges (3, 13, 15)
tyssue.generation.modifiers module#
This module provides utlities to modify an input tissue through extrusion or subdivision
- tyssue.generation.modifiers.create_anchors(sheet)[source]#
Adds an edge linked to every vertices at the boundary and create anchor vertices
- tyssue.generation.modifiers.extrude(apical_datasets, method='homotecy', scale=0.3, vector=[0, 0, - 1])[source]#
Extrude a sheet to form a monlayer epithelium
- Parameters
apical_datasets (*) –
'vert' –
'edge' –
'face' –
method (*) –
'homotecy' (if method ==) –
scale (by a factor given by) –
scaling (the scale factor for homotetic) –
0.3. (default) –
vector (*) –
translation (used for the) –
[0 (default) –
0 –
-1] –
'homotecy' –
the (the basal layer is scaled down from) –
coordinate (apical one homoteticaly w/r to the center of the) –
system –
scale –
'translation' (if method ==) –
from (basal vertices are translated) –
vect (the apical ones by the vector) –
'normals' (if method ==) –
from –
vertex (the apical ones along the normal of the surface at each) –
:param : :param by a vector whose size is given by scale:
- tyssue.generation.modifiers.subdivide_faces(eptm, faces)[source]#
Adds a vertex at the center of each face, and returns a new dataset
- Parameters
eptm (a
Epithelium
instance) –faces (list,) – indices of the faces to be subdivided
- Returns
new_dset – a dataset with the new faces devided
- Return type
dict
tyssue.generation.shapes module#
- class tyssue.generation.shapes.AnnularSheet(identifier, datasets, specs=None, coords=None)[source]#
Bases:
Sheet
2D annular model of a cylinder-like monolayer.
Provides syntactic sugar to access the apical, basal and lateral segments of the epithlium
- property apical_edges#
- property apical_verts#
- property basal_edges#
- property basal_verts#
- property lateral_edges#
- tyssue.generation.shapes.Lloyd_relaxation(sheet, geom, steps=10, coords=None, update_method=None)[source]#
Performs Lloyd relaxation on the sheet.
- tyssue.generation.shapes.ellipsoid_sheet(a, b, c, n_zs, **kwargs)[source]#
Creates an ellipsoidal apical mesh.
- Parameters
a (floats) – Size of the ellipsoid half axes in the x, y, and z directions, respectively
b (floats) – Size of the ellipsoid half axes in the x, y, and z directions, respectively
c (floats) – Size of the ellipsoid half axes in the x, y, and z directions, respectively
n_zs (int) – The (approximate) number of faces along the z axis.
get_ellipsoid_centers (kwargs are passed to) –
- Returns
eptm (a
Epithelium
object)The mesh returned is an Epithelium and not a simpler Sheet
so that a unique cell data can hold information on the
whole volume of the ellipsoid.
- tyssue.generation.shapes.generate_ring(Nf, R_in, R_out, R_vit=None, apical='in')[source]#
Generates a 2D tyssue object aranged in a ring of Nf tetragonal cells with inner diameter R_in and outer diameter R_out
- Parameters
Nf (int) – The number of cells in the tissue
R_in (float) – The inner ring diameter
R_out (float) – The outer ring diameter
R_vit (float) – The vitelline membrane diameter (a non strechable membrane around the annulus)
apical (str {'in' | 'out'}) – The side of the apical surface if “in”, the apical surface is inside the annulus, facing the lumen as in an organoid; if ‘out’: the apical side is facing the exterior of the tissue, as in an embryo
- Returns
eptm – 2D annular tissue. The R_in and R_out parameters are stored in the class settings attribute.
- Return type
- tyssue.generation.shapes.get_ellipsoid_centers(a, b, c, n_zs, pos_err=0.0, phase_err=0.0)[source]#
Creates hexagonaly organized points on the surface of an ellipsoid
- Parameters
a (float) – ellipsoid radii along the x, y and z axes, respectively i.e the ellipsoid boounding box will be [[-a, a], [-b, b], [-c, c]]
b (float) – ellipsoid radii along the x, y and z axes, respectively i.e the ellipsoid boounding box will be [[-a, a], [-b, b], [-c, c]]
c (float) – ellipsoid radii along the x, y and z axes, respectively i.e the ellipsoid boounding box will be [[-a, a], [-b, b], [-c, c]]
n_zs (float) – number of cells on the z axis, typical
pos_err (float, default 0.) – normaly distributed noise of std. dev. pos_err is added to the centers positions
phase_err (float, default 0.) – normaly distributed noise of std. dev. phase_err is added to the centers angle ϕ
- tyssue.generation.shapes.sheet_from_cell_centers(points, noise=0, interp_s=0.0001)[source]#
Returns a Sheet object from the Voronoï tessalation of the cell centers.
The strategy is to project the points on a sphere, get the Voronoï tessalation on this sphere and reproject the vertices on the original (implicit) surface through linear interpolation of the cell centers.
Works for relatively smooth surfaces (at the very minimum star convex).
- Parameters
points (np.ndarray of shape (Nf, 3)) – the x, y, z coordinates of the cell centers
noise (float, default 0.0) – addiditve normal noise stdev
interp_s (float, default 1e-4) – interpolation smoothing factor (might need to set higher)
- Returns
sheet
- Return type
a
Sheet
object with Nf faces
- tyssue.generation.shapes.spherical_monolayer(R_in, R_out, Nc, apical='out', Lloyd_relax=False)[source]#
Returns a spherical monolayer with the given inner and outer radii, and approximately the gieven number of cells.
The apical argument can be ‘in’ out ‘out’ to specify wether the apical face of the cells faces inward or outward, reespectively.
tyssue.generation.utils module#
Module contents#
The generation module provides utilities to easily
create Epithelium
objects.