aicscytoparam package

Subpackages

Submodules

aicscytoparam.cytoparam module

aicscytoparam.cytoparam.cellular_mapping(coeffs_mem: Dict, centroid_mem: List, coeffs_nuc: Dict, centroid_nuc: List, nisos: List, images_to_probe: List | None = None)[source]

Interpolate spherical harmonics coefficients representing the nuclear centroid, the nuclear shell and the cell membrane. As the coefficients are interpolated, polygonal meshes representing corresponding 3D shapes are reconstructed and used to probe input images and create intensity representations.

Parameters:
  • coeffs_mem (dict) – Spherical harmonics coefficients that represent cell shape.

  • centroid_mem (tuple) – (x,y,z) representing cell centroid

  • coeffs_nuc (dict) – Spherical harmonics coefficients that represent nuclear shape.

  • centroid_nuc (tuple) – (x,y,z) representing nuclear centroid

  • nisos (list) – [a,b] representing the number of layers that will be used to parameterize the nucleoplasm and cytoplasm.

  • images_to_probe (list of tuples) – [(a, b)] where a’s are names for the image to be probed and b’s are expected to be 3D ndarrays representing the image to be probed. The images are assumed to be previously registered to the cell and nuclear images used to calculate the spherical harmonics coefficients.

Returns:

result – Multidimensional image of shape 11C1YX, where Y is the number of interpolation levels and X is the number of points in the representation. C corresponds to the number of probed images.

Return type:

AICSImage

aicscytoparam.cytoparam.get_intensity_representation(polydata: vtkPolyData, images_to_probe: List)[source]

This function probes the location of 3D mesh points in a list of 3D images.

Parameters:
  • polydata (vtkPolyData) – Polygonal 3D mesh

  • images_to_probe (list of tuples) – [(a, b)] where a’s are names for the image to be probed and b’s are expected to be 3D ndarrays representing the image to be probed. The images are assumed to be previously registered to the cell and nuclear images used to calculate the spherical harmonics coefficients.

Returns:

result – [(a,b)] where a is the probed image name and b is a 1d array with the corresponding probed intensities.

Return type:

list of ndarrays

aicscytoparam.cytoparam.get_interpolators(coeffs_mem: Dict, centroid_mem: Dict, coeffs_nuc: Dict, centroid_nuc: Dict, nisos: List)[source]

Creates 1D interpolators for SHE coefficients with fixed points at: 1) nuclear centroid, 2) nuclear shell and 3) cell membrane. Also creates an interpolator for corresponding centroids.

Parameters:
  • coeffs_mem (dict) – Spherical harmonics coefficients that represent cell shape.

  • centroid_mem (tuple) – (x,y,z) representing cell centroid

  • coeffs_nuc (dict) – Spherical harmonics coefficients that represent nuclear shape.

  • centroid_nuc (tuple) – (x,y,z) representing nuclear centroid

  • nisos (list) – [a,b] representing the number of layers that will be used to parameterize the nucleoplasm and cytoplasm.

Returns:

  • coeffs_interpolator (spinterp.interp1d)

  • centroids_interpolator (spinterp.interp1d)

  • lmax (int)

aicscytoparam.cytoparam.get_mapping_coordinates(coeffs_mem: Dict, centroid_mem: List, coeffs_nuc: Dict, centroid_nuc: List, nisos: List)[source]

Interpolate spherical harmonics coefficients representing the nuclear centroid, the nuclear shell and the cell membrane. As the coefficients are interpolated, polygonal meshes representing corresponding 3D shapes are reconstructed and the coordinates of their points are returned.

Parameters:
  • coeffs_mem (dict) – Spherical harmonics coefficients that represent cell shape.

  • centroid_mem (tuple) – (x,y,z) representing cell centroid

  • coeffs_nuc (dict) – Spherical harmonics coefficients that represent nuclear shape.

  • centroid_nuc (tuple) – (x,y,z) representing nuclear centroid

  • nisos (list) – [a,b] representing the number of layers that will be used to parameterize the nucleoplasm and cytoplasm.

Returns:

coords – Array of shape 3xNxM, where NxM is the size of a parameterized intensity representation generated with same parameters nisos and same SHE degree.

Return type:

np.array

aicscytoparam.cytoparam.morph_representation_on_shape(img: array, param_img_coords: array, representation: array)[source]

Decodes the parameterized intensity representation into an image. To do so, an input image with the final shape is required.

Parameters:
  • img (np.array) – 3D binary image with the shape in which the representation will be decoded on.

  • img_param_coords (np.array) – Array of shape 3NM, where N is the number of

  • isovalues in the representation and M is the number of

  • points in each mesh used to create the representation.

  • This array should be generated by the function

  • param_img_coords.

  • representation (np.array) – Array of shape NM as generated by the function run_cellular_mapping.

Returns:

img – 3D image where voxels have their values interpolated from the decoded representation

Return type:

np.array

aicscytoparam.cytoparam.parameterization_from_shcoeffs(coeffs_mem: Dict, centroid_mem: List, coeffs_nuc: Dict, centroid_nuc: List, nisos: List, images_to_probe: List | None = None)[source]

Runs the parameterization for a cell represented by its spherical harmonics coefficients calculated by using ther package aics-shparam.

Parameters:
  • coeffs_mem (dict) – Spherical harmonics coefficients that represent cell shape.

  • centroid_mem (tuple) – (x,y,z) representing cell centroid

  • coeffs_nuc (dict) – Spherical harmonics coefficients that represent nuclear shape.

  • centroid_nuc (tuple) – (x,y,z) representing nuclear centroid

  • nisos (list) – [a,b] representing the number of layers that will be used to parameterize the nucleoplasm and cytoplasm.

  • images_to_probe (list of tuples) – [(a, b)] where a’s are names for the image to be probed and b’s are expected to be 3D ndarrays representing the image to be probed. The images are assumed to be previously registered to the cell and nuclear images used to calculate the spherical harmonics coefficients.

Returns:

result – Multidimensional image of shape 11C1YX, where Y is the number of interpolation levels and X is the number of points in the representation. C corresponds to the number of probed images.

Return type:

AICSImage

aicscytoparam.cytoparam.parameterize_image_coordinates(seg_mem: array, seg_nuc: array, lmax: int, nisos: List)[source]

Runs the parameterization for a cell represented by its spherical harmonics coefficients calculated by using ther package aics-shparam.

Parameters:
  • seg_mem (np.array) – 3D binary cell segmentation.

  • seg_nuc (np.array) – 3D binary nuclear segmentation.

  • lmax (int) – Degree of spherical harmonics expansiion.

  • nisos (list) – [a,b] representing the number of layers that will be used to parameterize the nucleoplasm and cytoplasm.

Returns:

  • coords (np.array) – Array of shape 3xNxM, where NxM is the size of a parameterized intensity representation generated with same parameters lmax and nisos.

  • coeffs_mem (dict) – Spherical harmonics coefficients that represent cell shape.

  • centroid_mem (tuple) – (x,y,z) representing cell centroid.

  • coeffs_nuc (dict) – Spherical harmonics coefficients that represent nuclear shape.

  • centroid_nuc (tuple) – (x,y,z) representing nuclear centroid.

aicscytoparam.utils module

aicscytoparam.utils.get_voxelized_image_of_mean_shape(vec: List, coeffs_mem: List, coeffs_nuc: List, return_meshes=False)[source]

Get the voxelized image of the mean shape :Parameters: * vec (List) – list of displacement vectors of nuclear centroid relative to cell centroid

  • coeffs_mem (List) – list of membrane coefficients

  • coeffs_nuc (List) – list of nuclear coefficients

  • return_meshes (bool) – return the meshes

Returns:

avg_image – voxelized image of the mean shape

Return type:

np.ndarray

aicscytoparam.utils.load_image_and_align_based_on_shape_library(path, library, nuc_channel=1)[source]

Load an image and align it based on a shape library :Parameters: * path (str) – path to the image

  • library (ShapeLibrary2D) – shape library

  • nuc_channel (int) – channel of the nucleus

Returns:

image_rot – aligned image

Return type:

np.ndarray

Module contents

Top-level package for aics-cytoparam.

aicscytoparam.get_module_version()[source]