Method Article

A Shape Analysis Algorithm Quantifies Spatial Morphology and Context of 2D to 3D Cell Culture for Novel Quantitation of Phenotypes

DOI:

10.3791/71066

July 21st, 2026

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This article explains how novel morphological features in cells and organoids can be quantified using the linearized compressed polar coordinates (LCPC) transform, a spatial algorithm that captures properties that traditional metrics, such as area, volume, and surface area, cannot. Best practices for shape orientation and alignment are discussed.

Abstract

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

Numerous studies have shown that the morphological phenotype of a cell or organoid correlates with its susceptibility to anti-cancer agents. However, traditional methods of measuring phenotype rely on spatial metrics such as area, volume, perimeter, and signal intensity, which work but are limited. These approaches cannot measure many crucial features of spatial context, such as chirality, a property of left- and right-handedness. Volume cannot be used to register chirality because the left and right shoes have the same volume. Though spatial context in the form of chirality, gravity direction, and polarity axis is intuitive to humans, the traditional metrics used by cell biologists, pathologists, radiologists, and machine learning practitioners to date cannot capture these fundamental notions. The linearized compressed polar coordinates (LCPC) transform is a novel algorithm that can capture spatial context unlike any other metric. The LCPC transform translates a two-dimensional (2D) contour into a discrete sinusoidal wave by overlaying a grid system that tracks the points of intersection between the contour and the grid lines. It turns the contour into a sequence of pairs of discrete coordinates, with the independent coordinate (x-coordinate) corresponding to consecutive positions in 2D space. Each dependent coordinate (y-coordinate) consists of the distance between an intersection of the contour and gridline to the origin or baseline of the grid system. In the form of a discrete sinusoid wave, the Fast Fourier Transform is then applied to the data. In this way, the shapes of cells in 2D and 3D cell culture are systematically and multidimensionally represented, enabling robust quantitative stratification that will reveal insights into treatment resistance.

Introduction

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

Three-dimensional (3D) organoid culture has proven superior to two-dimensional (2D) cell culture in mimicking in vivo biology1,2. Organoids have become indispensable in cancer research for screening for effective treatments and for gaining insights into disease progression3,4,5,6. While it is well known in cancer biology that distinctions in morphology correlate with distinct biological behavior of cells and tissues, the field relies on traditional shape metrics that are limited in scope. This study describes a novel spatial algorithm that objectively quantifies subtle morphological features with unprecedented precision, surpassing traditional approaches such as area, volume, and surface area.

The linearized compressed polar coordinates (LCPC) transform was invented to objectively and quantitatively describe complex morphologies observed in tissue histopathology, with the aim of enhancing the grading of colon polyps7. The desire to then expand this approach to capture macroscopic MRI-based spatial features in brain pathologies, such as bipolar disorder and Alzheimer’s disease, led to augmentations that enhanced it even further. This study describes the step-by-step protocol and best practices for applying two versions of the LCPC transform: the parallel grid system and the radial grid system, both of which have open-source scripts and tutorial videos.

Aside from traditional geometric methods, there exist multiple abstractions that have been effective for measuring the complex shapes of cells and organs. These include measuring eccentricity, skewness, contrast, and kurtosis, along with Zernike moments for capturing circularity, asymmetry, edge irregularity, and global contour structure8,9,10. Fractal analysis has also been useful to reduce complex contours into scalar values, such as Fractal Dimension, which measures how irregular the contour is, and lacunarity, which measures how heterogeneously irregular gaps appear in the contour11,12. For measuring texture, the Gray Level Co-occurrence Matrix (GLCM) method is popular for measuring contrast, energy, homogeneity, correlation, and entropy13,14. While all of these methods are beneficial, none of them were designed to capture spatial context, such as the direction of gravity, left- vs. right-handedness, or the location of the central support structure that influences the direction of shape change. Furthermore, many of them produce a single scalar value or just a handful of scalar values to represent spatial information, which is why the cited studies often use them in combination to assess complex shapes.

The LCPC transform was designed to produce many features from one measurement and to allow the addition of spatial markers that encode spatial context into the shape, such as the direction of gravity. The closest method to the LCPC transform7 was published a year afterwards15, sharing the same core idea as a starting point: apply the Fourier transform to cell contours to measure shape in the form of a frequency spectrum. However, the LCPC transform was independently developed to be applied via distinct grid systems that were meant to be used in conjunction with knowledge of the spatial context outside of the shape being measured. Furthermore, the inventor of the LCPC transform explains in this manuscript that the resulting frequency spectrum contains vast amounts of hidden spatial information. Supplementary File 1 contains an extensive discussion of spatial contexts in biology that are often overlooked when using the cited methods and how the LCPC transform can be applied to capture this context. For readers whose shape data shows no difference between control vs. experimental groups, whether or not their eyes can see a difference in the shapes, or whose shape data shows very little difference, even though they suspect that there should be a bigger difference, they should try the LCPC transform.

The LCPC transform provides an unprecedented level of precision in measuring spatial information because it represents shapes in multiple dimensions. Unlike traditional methods, like area and volume, which yield only one scalar value per shape (i.e., 25 cm2), the results of the LCPC transform can yield multiple indices, each correlating with a different morphological aspect of a shape (i.e., roundness vs. sharpness of corners, smoothness vs. jaggedness of edges). The LCPC transform describes a 2D shape by overlaying a grid of straight lines that intersect its contour. Each grid system has an origin (Figure 1) or a baseline (Figure 2) from which to measure linear distance. Refer to Figures 1B and 2B for simplified flowcharts describing the algorithm. Every point of intersection between the gridlines and the shape's contour is detected. The distance of each intersection is then calculated relative to a baseline or origin. In this way, the LCPC transform converts 2D shapes into a series of consecutive x-y coordinate pairs. The x-coordinate represents the position of the gridline from zero to infinity, while the y-coordinate represents the distance of the intersection to the baseline or origin. In this form, which is a discrete sinusoid wave, the Fast Fourier transform (FFT) is then applied to convert the data from the “position domain” to the frequency domain. If the x-coordinate represented time, then the “position domain” would be equivalent to the “time domain” in the standard applications of the FFT.

While the radial grid system measures the distance of each intersection from the origin of the radial grid (Figure 1A), the parallel grid system always measures the distance of intersections with reference to an imaginary line at the left of the shape (Figure 2A). The open-source script determines the position of this imaginary line by finding the left-most pixel of the contour and then moving 10 pixels to the left of this position. Here, the x-coordinate of this position becomes the reference line from which all intersections are calculated. This 10-pixel rule is arbitrary, but it is why all contours analyzed by the open-source script for the parallel grid system must have at least 15 pixels of white space on all four sides.

For 2D shapes with folds or multiple layers, gridlines may intersect the contour more than once. In this case, the distances of all intersections along a gridline are summed to a single value. Thus, each gridline has only one x-coordinate and one y-coordinate. This summation is represented by the term “compressed” in the name LCPC transform. The rendering of a non-linear 2D shape into a discrete sinusoid wave is represented by the term “linearized” in the algorithm’s name. Lastly, the term “polar coordinates” is in the algorithm’s name because the first grid system conceptualized was a 180-degree radial grid of polar coordinates7. Even after realizing that polar and Cartesian coordinates are interchangeable, the algorithm's name was kept as is. The acknowledgments section describes the personal reasons that motivated the invention and augmentation of the LCPC transform.

Protocol 1 was the sequence for obtaining the data shown in Figure 3B, while Protocol 2 was the sequence for obtaining the data shown in Figure 3C–D. The steps in these protocols are implemented in individual Python scripts available in the GitHub repository “Pre-Processing-Tools-for-LCPC-Transform”16. Protocol 1 is an example of the pre-processing steps to derive “pure shape” in preparation for the LCPC transform. Protocol 2 is an example of pre-processing steps to measure shapes “at scale”, meaning at their original scales relative to each other.

Segmentation can be done manually in image processing software, such as Mac’s Preview or Microsoft’s Paint, or using threshold-based methods. If done manually, one of the following four colors should be chosen: blue, green, pink/magenta, or red. The GitHub repository called “Pre-Processing-Tools-for-LCPC-Transform”16 contains a folder called “color extraction scripts”. This folder contains four Jupyter Notebook files with Python code that extract the four aforementioned colors and convert them into blue masks on a white background. This process can also be performed by thresholding the outline color in an image processing software such as Fiji/ImageJ. For images that contain contours with touching borders or overlapping edges (e.g., a Venn Diagram), they will need to be separated using image processing software, so that they become independent objects in the composite mask image containing multiple organoid contours. This does not apply to images that contain only one organoid or multiple organoids that don’t touch each other.

Access restricted. Please log in or start a trial to view this content.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

Primary human cells used in this study were obtained and cultured under ethics approvals and informed consent procedures previously reported17. Images presented here were generated from those approved cell cultures and are published for the first time. Tissue specimens were collected at Brigham and Women’s Hospital and the University of California, San Francisco under Institutional Review Board (IRB)-approved protocols from patients who provided informed consent for research use of their tissues, as previously described17. No additional human specimen collection was performed for this study.

1. Extracting the pure shape of 2D organoid contours for the LCPC transform

  1. Segment the outer edge of each organoid using any image processing software, such as Microsoft’s Paint, MacOS’ Preview, or Fiji/ImageJ.
  2. Extract the contours of the organoids as open masks that are blue lines on a white background.
  3. Isolate each blue contour onto its own white canvas.
    NOTE: This step is only necessary if an image contains more than one contour.
  4. Crop each contour to have a one-pixel margin on all four sides of the blue object.
  5. Add 100 pixels of white space on all four sides to create new margins.
  6. Rotate the objects such that the longest internal length is horizontal.
    NOTE: This step turns the longest internal line within each object into the object’s width. There are two scripts available for this purpose. For closed shapes, use the Jupyter Notebook named “Rotate CLOSED Object Horizontal by Longest Internal Length_v2.ipynb”. For open shapes or shapes with multiple components, use the Jupyter Notebook named “Rotate Green Line_v3.ipynb”. The Rotate Green Line tool has a video tutorial that is linked in the ReadMe file contained within the same folder as the .ipynb file.
  7. Crop each image to have a one-pixel margin on all four sides of the blue object.
    NOTE: This is the same as Step 1.4. The purpose of trimming this time, however, is that the resizing step that comes next resizes the entire canvas, not just the blue object in it. Thus, by making the blue object nearly the same width and height as the canvas itself, resizing the canvas to 400 pixels wide also resizes the object to be nearly 400 pixels wide. There is a Jupyter Notebook named “Trim margin to 1-pixel border.ipynb”.
  8. Resize the canvas width of each image to be 400 pixels wide while also constraining the aspect ratio.
    NOTE: This step makes each object have the same width. Constraining the aspect ratio prevents skewing the object during the resizing. There is a Jupyter Notebook named “Resize width to 400 pixels but constrain aspect ratio.ipynb”.
  9. Add 100 pixels of white space on all four sides to create new margins.
  10. Rotate each image either 90 degrees clockwise or counterclockwise to make the longest internal length vertical, being consistent with the choice for all images.
    NOTE: In the above sequence, pure shape is obtained by sequentially implementing Steps 1.6, 1.7, 1.8, and 1.9. Adding margin space in Step 1.9 is required to avoid errors in the LCPC transform scripts that will be done next, but is not involved in extracting the pure shape. Users who wish to measure shapes “at-scale” need not perform Steps 1.6, 1.7, and 1.8 in the above sequence, though they should still preprocess their mask images to achieve optimal orientation before applying the LCPC transform.
  11. Perform the LCPC transform on each contour. Use Python scripts provided for the radial grid method18 or the parallel grid method19.

2. Extracting at-scale shape of 2D organoid contours for the LCPC transform

NOTE: The step-by-step method for extracting the at-scale shape of objects is similar to that for extracting pure shape in Protocol 1 above. The steps are named identically in both protocols for ease of matching. Please refer to the notes in Protocol 1 for each step. The main difference between pure shape and at-scale shape is that at-scale shape does not require Steps 1.6, 1.7, and 1.8, which are the resizing steps.

  1. Segment the outer edge of each organoid. Use a computational approach or do it manually via a basic image editing software, such as Microsoft’s Paint, MacOS’ Preview, or Fiji/ImageJ.
  2. Extract the contours of the organoids as open masks that are blue lines on a white canvas. Use Fiji/ImageJ to extract masks or the Python script provided16.
  3. Isolate each blue contour onto its own white canvas. Use Fiji/ImageJ to extract masks or the Python script provided16.
  4. Crop each contour to have a one-pixel margin on all four sides of the blue object. Use Fiji/ImageJ or the Python script provided16.
  5. Add 100 pixels of white space on all four sides to create new margins. Use Fiji/ImageJ or the Python script provided16.
  6. Rotate each contour such that its longest internal line is vertical. Use Fiji/ImageJ or the Python script provided16.
  7. Perform the LCPC transform on each contour. Use Python scripts provided for the radial grid method18 or the parallel grid method19.

Access restricted. Please log in or start a trial to view this content.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The radial grid LCPC transform applied to breast cancer organoids

3D organoids and tumors can adopt a variety of shapes, some of which are obviously different to the human eye, even though traditional metrics yield statistically insignificant differences. On the other hand, organoids can also exhibit shapes that seem heterogeneous, and thus insignificant, to the human eye, masking recurring subtle morphologies that represent distinct subtypes. Human primary breast organoids we...

Access restricted. Please log in or start a trial to view this content.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

As with any computational tool, the quality of the output depends on whether the inputs adhere to the expected rules around which the tool was designed. The following rules should be followed and used as quality control checks when utilizing the provided Python scripts. First, make sure that the open masks are blue lines on a white background. Blue was an arbitrary decision and has no significance, but the scripts that perform the LCPC transform were written to search for blue pixels on a white background. Second, do not...

Access restricted. Please log in or start a trial to view this content.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors have no conflicts of interest to disclose. The LCPC transform was commercialized as the software product “Shape Genie” by BrainScanology, Inc., but the patent applications were withdrawn, and the company was dissolved. This study is available as a preprint in BioRxiv, as cited in the listed reference47. Figure 4 shows previously unpublished views generated from the 3D imaging dataset reported31 and provided by Gkontra; we have rightfully acknowledged them. Figure 3 and Supplementary Figure 1 show previously unpublished images derived from primary human cell cultures established under the ethics approvals and informed consent procedures reported21 by a co-author. No additional human specimen collection was performed for this study.

Acknowledgements

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

We would like to acknowledge Duane Nichols, a high school science teacher who passed away from colon cancer. This inspired the invention of the LCPC transform to characterize the morphology of colon polyps. Second, we would also like to thank Thuan Trinh, who suffered from Bipolar Disorder 2 and inspired the enhancement of the LCPC transform, such as adding markers to capture spatial context. The LCPC transform is informally called the Nguyen-Nichols-Trinh (NNT) transform. Third, we would like to thank Paul Leal, the lead angel investor, who supported the startup that attempted to commercialize the LCPC transform. Fourth, we would like to thank Polyxeni Gkontra, Ph.D., for sharing photomicrographs of cardiac vasculature for this study. Fifth, we would like to thank the DF/HCC Breast SPORE: Specialized Program of Research Excellence (SPORE) (NCI 1P50CA168504), the UCSF Breast Care Center surgical and pathology teams, and the Breast Care Center interns for assistance with tissue specimen and funding support from the National Institutes of Health (R01CA281361).

Access restricted. Please log in or start a trial to view this content.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
Add 100 pixels to margins.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Average K-means Nearest Neighbor via sklearn version 1.6.1SciKit Learnhttps://scikit-learn.org/stable/modules/generated/sklearn.neighbors.NearestNeighbors.htmlUsed the NearestNeighbors function within the sklearn.neighbors package
BLUE_Color Extraction.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Chamfer Distance via scipy version 1.15.1SciPyhttps://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.cKDTree.htmlUsed cKDTree function within scipy.spatial package
Cliff's DeltaTissue Spatial Geometrics Labhttps://github.com/dh2nguyen/Cliffs-DeltaCreated an implementation of Cliff's Delta via the Python language
Enlarge Image Size by 3X.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Fiji/ImageJ v2.14.0ImageJ.nethttps://imagej.net/
Flip images HORIZontally.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Flip images VERTically.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
GREEN_Color Extraction.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Isolate Objects Empty Blue.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
MacOS Preview Version 11.0 Apple Inchttps://support.apple.com/guide/preview/welcome/mac
Master Script_Parallel Grid LCPC_DN_071025.ipynbTissue Spatial Geometrics LabGitHub Repo Address: https://github.com/dh2nguyen/Radial-Grid-LCPC-TransformPython Script in a Jupyter Notebook
Master Script_Radial Grid LCPC_bBoxCentered.ipynbTissue Spatial Geometrics LabGitHub Repo Address: https://github.com/dh2nguyen/Parallel-Grid-LCPC-TransformPython Script in a Jupyter Notebook
Microsoft PaintMicrosofthttps://www.microsoft.com/en-us/windows/tips/paintWas mentinoed as a potential useful tool for manual segmentation, but not used in this study
Microsoft Powerpoint Version 16.109.3Microsofthttps://www.microsoft.com/en-us/microsoft-365/p/powerpoint/cfq7ttc0pbmc
PINK_Color Extraction.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Principal Component Analysis (PCA) via sklearn version 1.6.1SciKit Learnhttps://scikit-learn.org/stable/api/sklearn.decomposition.htmlUsed the PCA function with the sklearn.decomposition package
RED_Color Extraction (Mac).ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
RED_Color Extraction (Windows).ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Resize width to 400 pixels but constrain aspect ratio.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Rotate CLOSED Object Horizontal by Longest Internal Length.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Rotate Green Line_v3.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Rotate images 90CCW.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Rotate images 90CW.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Thicken Blue Lines.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook
Trim margin to 1-pixel border.ipynbTissue Spatial Geometrics LabGitHub Repo Name: Pre-Processing-Tools-for-LCPC-Transform | GitHub Repo Address: https://github.com/dh2nguyen/Pre-Processing-Tools-for-LCPC-TransformPython Script in a Jupyter Notebook

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

Morphological PhenotypeSpatial ContextLCPC TransformChirality AnalysisFast Fourier TransformQuantitative Stratification3D Cell Phenotypes
Video Coming Soon

Related Articles