SyMBac.drawing
- SyMBac.drawing.OPL_to_FL(cell, density)[source]
- Parameters
cell (np.ndarray) – A 2D numpy array consisting of a rasterised cell
density (float) – Number of fluorescent molecules per volume element to sample in the cell
- Returns
A cell with fluorescent reporters sampled in it
- Rtypes
np.ndarray
- SyMBac.drawing.draw_scene(cell_properties, do_transformation, space_size, offset, label_masks, pinching=True)[source]
Draws a raw scene (no trench) of cells, and returns accompanying masks for training data.
- Parameters
properties (cell) – A list of cell properties for that frame
do_transformation (bool) – True if you want cells to be bent, false and cells remain straight as in the simulation
space_size (tuple) – The xy size of the numpy array in which the space is rendered. If too small then cells will not fit. recommend using the
SyMBac.drawing.get_space_size()function to find the correct space size for your simulationoffset (int) – A necessary parameter which offsets the drawing a number of pixels from the left hand side of the image. 30 is a good number, but if the cells are very thick, then might need increasing.
label_masks (bool) – If true returns cell masks which are labelled (good for instance segmentation). If false returns binary masks only. I recommend leaving this as True, because you can always binarise the masks later if you want.
pinching (bool) – Whether or not to simulate cell pinching during division
- Returns
space, space_masks (2D numpy array, 2D numpy array)
space (2D numpy array) – Not to be confused with the pyglet object calledspace in some other functions. Simply a 2D numpy array with an image of cells from the input frame properties
space_masks (2D numy array) – The masks (labelled or bool) for that scene.
- SyMBac.drawing.find_farthest_vertices(vertex_list)[source]
Given a list of vertices, find the pair of vertices which are farthest from each other
- SyMBac.drawing.gen_cell_props_for_draw(cell_timeseries_lists, ID_props)[source]
- Parameters
- Returns
cell_properties – The final property list used to actually draw a scene of cells. The input to draw_scene
- Return type
- SyMBac.drawing.generate_curve_props(cell_timeseries)[source]
Generates individual cell curvature properties. 3 parameters for each cell, which are passed to a cosine function to modulate the cell’s curvature.
- Parameters
cell_timeseries (list(cell_properties)) – The output of
SyMBac.simulation.Simulation.run_simulation()- Returns
outupt
- Return type
A numpy array of unique curvature properties for each cell in the simulation
- SyMBac.drawing.get_distance(vertex1, vertex2)[source]
Get euclidian distance between two sets of vertices.
- SyMBac.drawing.get_space_size(cell_timeseries_properties)[source]
- Parameters
cell_timeseries_properties – A list of cell properties over time. Generated from
SyMBac.simulation.Simulation.draw_simulation_OPL()- Returns
Iterates through the simulation timeseries properties, finds the extreme cell positions and retrieves the required image size to fit all cells into.
- Return type
- SyMBac.drawing.make_images_same_shape(real_image, synthetic_image, rescale_int=True)[source]
Makes a synthetic image the same shape as the real image
- SyMBac.drawing.midpoint_intercept(vertex1, vertex2)[source]
Get the y-intercept of the line connecting two vertices
- SyMBac.drawing.place_cell(length, width, angle, position, space)[source]
Creates a cell and places it in the pymunk space
- SyMBac.drawing.raster_cell(length, width, separation, pinching=True, FL=False)[source]
Produces a rasterised image of a cell with the intensiity of each pixel corresponding to the optical path length (thickness) of the cell at that point.
- Parameters
- Returns
cell – A numpy array which contains an OPL image of the cell. Can be converted to a mask by just taking
cell > 0.- Return type
np.array