VisuSPHARM links 3D shape cell and cell position information in an interactive plot.
Medial-Lateral shape differences
The following modules will be installed on setup.
- Numpy
- Scipy
- Matplotlib
- Pandas
- Jupyter Notebooks
- Scikit-image
- tqdm
- Holoviews
- Bokeh
- Seaborn
- UMAP-learn
The following scripts were tested on MATLAB 24.2.0.2773142 (R2024b) Update 2 and Python 3.10.16.
In progress
Clone the repository:
git clone https://github.com/TimSaundersLab/VisuSPHARM.git
cd VisuSPHARM
Create new environment and install VisuSPHARM:
conda create --name VisuSPHARM
pip install .
Given a 3D segmented image of a collection of cells, each cell needs to be saved as an individual 3D tif file as an input for computing SPHARM coefficients. The function VisuSPHARM.tools.save_cells is provided to preprocess this automatically, given an 3D segmented input.
There are various methods of obtaining SPHARM coefficients. In this guide we will use SPHARM-RPDM in CellOrganizer v2.10 developed by the Murphy Lab, Carnegie Mellon University. The requirements for this can be found here. The latest version of CellOrganiser can be cloned directly from the repository:
git clone https://github.com/murphygroup/cellorganizer.git
A MATLAB script spharm_rpdm_run.m is provided to compute the SPHARM coefficients using SPHARM-RPDM, which are compute
After executing the script, it will ask for the location of your CellOrganizer folder to input along with the input of your segmented cells. Processing time depends on the size (and shape) of your image inputs, a 10,000 voxel cell takes around 15 minutes to process.
If the segmentation quality is poor or if number of degrees is too low the reconstructed image may be outside of the minimum threshold, if so improve segmentation or increase hd_threshold.
A MATLAB runtime executable will be provided in the future to be able to run this without a MATLAB licence. Alternatively, the method which SPHARM-RPDM builds upon, SPHARM-PDM, is available through SlicerSALT.
The provided notebook visualisations.py provides instructions to create the visualisation.
Shape descriptors SPHARM coefficients obtained from the 3D cell segmentations are visualised in a 2D plot using UMAP, split separately into real and imaginary parts.
Other methods of dimensionality reduction can be used to as long as the result is a 2D scatter plot.
We use linked Bokeh plots in HoloViews to create the interactive visualisation. The two plots are linked together such that a selection in either plot will highlight the represented cells in the other.
The shape information is conveyed through the left plot (UMAP), with spatial localisation in the right plot. Spatial information is conveyed through a 2D cross-sectional slice of the 3D segmentation where the z height is chosen. Any cells that are not captured within the cross section are still placed in the UMAP but are not linked to a visible cell in the cross section.
We provide a simple function for creating linked plots, along with more detailed plotting configuration options in the script. Further customisation information can be found on the HoloViews wiki.