convert_to_simularium_shapes#
- CELL_STATES: list[str] = ['UNDEFINED', 'APOPTOTIC', 'QUIESCENT', 'MIGRATORY', 'PROLIFERATIVE', 'SENESCENT', 'NECROTIC']#
Indexed cell states.
- EDGE_TYPES: list[str] = ['ARTERIOLE', 'ARTERY', 'CAPILLARY', 'VEIN', 'VENULE', 'UNDEFINED']#
Indexed graph edge types.
- convert_to_simularium_shapes(series_key: str, simulation_type: str, data_tars: dict[str, tarfile.TarFile], frame_spec: tuple[int, int, int], box: tuple[int, int, int], ds: tuple[float, float, float], dt: float, colors: dict[str, str], resolution: int = 0, jitter: float = 1.0) str [source]#
Convert data to Simularium trajectory using shapes.
- Parameters:
series_key – Simulation series key.
simulation_type ({'patch', 'potts'}) – Simulation type.
data_tars – Map of simulation data archives.
frame_spec – Specification for simulation ticks.
box – Size of bounding box.
ds – Spatial scaling in um/voxel.
dt – Temporal scaling in hours/tick.
colors – Map of category to colors.
resolution – Number of voxels represented by a sphere (0 for single sphere per cell).
jitter – Relative jitter applied to colors (set to 0 for exact colors).
- Returns:
Simularium trajectory.
- format_patch_for_shapes(series_key: str, cells_tar: tarfile.TarFile | None, graph_tar: tarfile.TarFile | None, frames: list[float], bounds: int) pd.DataFrame [source]#
Format
patch
simulation data for shape-based Simularium trajectory.- Parameters:
series_key – Simulation series key.
cells_tar – Archive of cell agent data.
graph_tar – Archive of vascular graph data.
frames – List of frames.
bounds – Simulation bounds size (radius + margin).
- Returns:
Data formatted for trajectory.
- convert_hexagonal_to_rectangular_coordinates(uvw: tuple[int, int, int], bounds: int, offset: int) tuple[float, float] [source]#
Convert hexagonal (u, v, w) coordinates to rectangular (x, y) coordinates.
Conversion is based on the bounds of the simulation,
- Parameters:
uvw – Hexagonal (u, v, w) coordinates.
bounds – Simulation bounds size (radius + margin).
offset – Index of hexagonal offset.
- Returns:
Rectangular (x, y) coordinates.
- calculate_patch_size(radius: int, margin: int) tuple[int, float, float] [source]#
Calculate hexagonal patch simulation sizes.
- Parameters:
radius – Number of hexagonal patches from the center patch.
margin – Number of hexagonal patches in the margin.
- Returns:
Bounds, length, and width of the simulation bounding box.
- format_potts_for_shapes(series_key: str, cells_tar: tarfile.TarFile, locations_tar: tarfile.TarFile, frames: list[float], resolution: int) pd.DataFrame [source]#
Format potts simulation data for shape-based Simularium trajectory.
The resolution parameter can be used to tune how many spheres are used to represent each cell. Resolution = 0 displays each cell as a single sphere centered on the average voxel position. Resolution = 1 displays each individual voxel of each cell as a single sphere.
Resolution = N will aggregate voxels by dividing the voxels into NxNxN cubes, and replacing cubes with at least 50% of those voxels occupied with a single sphere centered at the center of the cube.
For resolution > 0, interior voxels (fully surrounded voxels) are not removed.
- Parameters:
series_key – Simulation series key.
cells_tar – Archive of cell data.
locations_tar – Archive of location data.
frames – List of frames.
resolution – Number of voxels represented by a sphere (0 for single sphere per cell).
- Returns:
Data formatted for trajectory.
- approximate_radius_from_voxels(voxels: int) float [source]#
Approximate display sphere radius from number of voxels.
- Parameters:
voxels – Number of voxels.
- Returns:
Approximate radius.