Spectral module#

class napari_shape_odyssey.spectral.LBOIntensityExpander(normalize: bool = False, order: int = 1000)#

Expand intensities on the vertices of a surface in a Laplace-Beltrami basis.

Parameters
  • normalize (bool) – Whether to normalize the input intensity array.

  • order (int) – The order of the expansion.

coefficients_#

The expansion coefficients.

Type

np.ndarray

eigenvectors#

The eigenvectors of the Laplace-Beltrami operator.

Type

np.ndarray

eigenvalues#

The eigenvalues of the Laplace-Beltrami operator.

Type

np.ndarray

See also

If you use this functionality in your work, please cite:

[0] Mazloom-Farsibaf, Hanieh, et al. “Cellular harmonics for the

morphology-invariant analysis of molecular organization at the cell surface.” Nature Computational Science 3.9 (2023): 777-788.

characterize_contributions_per_level(normalize_eigenvalues: bool = True)#

Characterize the contribution of each level to the expansion.

the characterizations include the mean and standard deviation of the difference between the expanded intensity and the input intensity per level. Moreover, the energy of the expansion per level is calculated.

Parameters

normalize_eigenvalues (bool) – Whether to normalize the eigenvalues by the slope of a linear fit. Setting this to True will make the energy per level scale-invariant.

Returns

df – A dataframe with the characterizations per level.

Return type

pd.DataFrame

expand() napari.types.SurfaceData#

Expand the intensity array to the vertices of the surface.

Parameters

None (None) –

Returns

expanded_intensity – The expanded intensity array is stored as the value of the surface tuple.

Return type

‘napari.types.SurfaceData’

fit(surface: napari.types.SurfaceData)#

Fit the expansion coefficients to the surface.

Parameters

surface (napari.types.SurfaceData) – A napari surface tuple.

Returns

None – The coefficients are stored in self.coefficients_.

Return type

None

fit_expand(surface: napari.types.SurfaceData) napari.types.SurfaceData#

Fit the expansion coefficients to the surface and expand the intensity array to the vertices of the surface.

Parameters

surface (napari.types.SurfaceData) – A napari surface tuple.

Returns

expanded_intensity – The expanded intensity array is stored as the value of the surface tuple.

Return type

‘napari.types.SurfaceData’

napari_shape_odyssey.spectral.shape_fingerprint(surface: napari.types.SurfaceData, order: int = 100, robust: bool = False) Tuple#

Compute the shape fingerprint of a surface.

Parameters
  • surface (napari.types.SurfaceData) – A napari surface tuple.

  • order (int, optional) – The order of shape spectrum to caluculate, by default 100

  • robust (bool, optional) – Use robust laplacian or not, by default False. In essence, if set to true, a smoothed laplacian will be used which is numerically more stable, but smoothes out geometry.

Returns

  • eigenvectors (np.ndarray) – The eigenvectors of the shape fingerprint.

  • eigenvalues (np.ndarray) – The eigenvalues of the shape fingerprint.