TASI: A software tool for spatial-temporal quantification of tumor spheroid dynamics

Spheroid cultures derived from explanted cancer specimens are an increasingly utilized resource for studying complex biological processes like tumor cell invasion and metastasis, representing an important bridge between the simplicity and practicality of 2-dimensional monolayer cultures and the complexity and realism of in vivo animal models. Temporal imaging of spheroids can capture the dynamics of cell behaviors and microenvironments, and when combined with quantitative image analysis methods, enables deep interrogation of biological mechanisms. This paper presents a comprehensive open-source software framework for Temporal Analysis of Spheroid Imaging (TASI) that allows investigators to objectively characterize spheroid growth and invasion dynamics. TASI performs spatiotemporal segmentation of spheroid cultures, extraction of features describing spheroid morpho-phenotypes, mathematical modeling of spheroid dynamics, and statistical comparisons of experimental conditions. We demonstrate the utility of this tool in an analysis of non-small cell lung cancer spheroids that exhibit variability in metastatic and proliferative behaviors.

there is a gap between mathematical modeling of behavior following feature extraction, with both capabilities often not available in the same tool 34,35 .
Leader and follower cells were defined in the collective migration process, in which leader cells were migrating at the leading edge of the collective sheet or spheroid, whereas follower cells followed or attached to the leader cells. Leader and follower cells showed distinctive morphology and migration behaviors. For example, leader cells had larger size 29 and were more mesenchymal-like 36 . They formed large lamellipodium and migrated with persistent protrusion 37 . Follower cells were smaller 29 and more epithelial-like 36 . Although leader and follower cell migration behavior were widely studied, most were conducted in 2-dimensional models and there were no standard features selected to quantify the morphology differences between them. Furthermore, many researchers still used manual selection to quantify the morphology features of these cells, which limited the number of cells studied and was time-consuming and subjective.
In this paper, we describe TASI, an open-sourced software framework for end-to-end Temporal Analysis of Spheroid Imaging (http://github.com/cooperlab/TASI). This framework allows investigators to automatically segment spheroid images, extract features describing their shape, growth, and invasiveness, and to perform mathematical modeling and statistical analyses of these features to compare treatment and control populations of spheroids. This approach improves the efficiency and objectivity of investigations utilizing spheroid models, and is open-source and extensible by the research community. We demonstrate the utility of this framework with an analysis of lung cancer spheroids and show TASI can discriminate different invasive phenotypes.

Materials and Methods
An overview of the TASI framework is presented in Fig. 1 (see Supplement Fig. S1 for details). Spheroids are first imaged under variable experimental conditions to produce 4D volumes (x, y, z, time). Images are then processed using a segmentation algorithm to delineate spheroid boundaries and features are extracted to describe their spatiotemporal characteristics. The temporal evolution of features is described using mathematical models, and statistical tests are performed to compare parameters across conditions, and visualizations are generated. These steps are described in greater detail below.
Spheroid culture and imaging. Data for validating the TASI framework was generated using the SpAtiotemporal Genomic and cellular Analysis (SaGA) technique to create spheroid cultures that represent the different invasive and metastatic phenotypes observed in lung cancer 38 . First, parental H1299 non-small cell lung cancer spheroids were embedded in a 3-dimensional matrix and visualized using a Leica SP8 confocal microscope. These spheroids contain cells that exhibit a variety of invasive tendencies, forming chain-like growths containing multiple cells that project from the main spheroid body (see example Fig. 2a). The cells at the tips of these chains were isolated using SaGA and cultured to form "leader" cell spheroids (see example Fig. 2a). The cells following the leaders within the chain-like projections were similarly isolated to produce "follower" spheroids (see example Fig. 2a). Each spheroid was imaged at x, y, z planes every 10 minutes for a minimum 14 hours. The 10-minute interval was selected to minimize differences between image frames, making image segmentation smooth across time, while not inducing photo bleaching or toxicity in the 14-hour duration. A total of 6 parental spheroids, 3 leader spheroids and 3 follower spheroids were imaged for the purposes of generating data to validate the ability of our software to quantify cancer invasion and metastasis. The leader/follower/parental spheroids were chosen for study to ensure that TASI can analyze the full spectrum of morphologies and dynamics presented by cancer spheroid models. Where leader spheroids are highly dynamic and morphologically complex, follower spheroids are indolent and nearly spherical. Most cancer spheroids, like our parental spheroids, have intermediate dynamics and morphologic qualities. Detailed experimental methods for cell culture and imaging are provided in supplementary methods.
Preprocessing and image segmentation. Preprocessing methods are employed to enhance the contrast and salience of structures to improve image segmentation quality (see Fig. 3). Four-dimensional volumes are first projected to 3-dimensional (x, y, t) using the standard deviation filter developed in 39 . At a given time t 0 , the volumetric image I(x, y, z i , t 0 ) contains multiple focal planes z i (see Fig. 3a). Uneven illumination of the focal plane in semi-solid gels can weaken the appearance of structures (see Fig. 3a, Z = 5, t 0 ) making segmentation difficult.
To correct this a standard deviation filter is applied at each time point to integrate focal planes and to define the 2-dimensional image sequence I p (x, y, t) = σ z [I(x, y, z, t)]. These time-domain volumes are then Gaussian smoothed in both space (x, y) and time (t) to further mitigate noise. To delineate the spheroid boundaries, we leverage both spatial and temporal structure simultaneously by using an energy-minimizing graph cut segmentation [40][41][42] . The max-flow graph cut provides a smooth segmentation in both space and time using the similarities of spatial-temporal pixel neighbors. Treating these pixels as a spatial-temporal graph, where edge weight corresponds to inverse similarity, the algorithm finds an energy-minimizing cutting path through the volume to partition foreground and background regions. Example segmentations are provided in Fig. 2. The time interval used for imaging has important implications for image segmentation. A long time interval could result in significant differences between frames, leading to discontinuities in the image segmentation across time. While short time intervals are desirable for segmentation, photo bleaching and toxicity issues can arise. If necessary, users can select 2-dimensional graph cut segmentation in the software settings to perform segmentation independently for each frame for longer imaging intervals.
Feature extraction. Given spheroid segmentation masks, TASI extracts a number of features to characterize static spheroid morphology at each time-point in the volume (see complete list, Table 2). Basic morphology features including area, perimeter, eccentricity, and intensity statistics are calculated. Complexity of the spheroid boundary is also measured as More irregular shapes will have larger perimeters for a corresponding area, translating to higher complexity measures (a circle has complexity 1).
Spheroids often exhibit interesting branching behavior, forming thin branches of invasive cells that protrude from the main spheroid mass. To quantify this phenomenon, we defined a "core radius" that captures the size of the main spheroid mass and an "invasive radius" that captures the extent of the projections (see Fig. 1). The core radius was defined as the radius of the largest circle that can be inscribed within the spheroid mask, centered at the mask centroid. The invasive radius was defined from the minimum circle that can encompass the entire spheroid, including any invasive branches. These radii roughly capture growth due to proliferation and growth due to invasion. The number of the branches was further quantified using a skeletonization procedure. Morphological operations were applied to thin the mask to a skeletal structure, and the terminal endpoints were counted. This process robustly captures the tips of branching structures, even with complex shapes (see Figs 1 and 2b). The presence of any isolated "cells" not connected from the main spheroid mass was also measured. These leaders are biologically extremely significant and may be represent a distinct cell phenotype with strong metastatic potential (see example Fig. 1). These objects were detected by labeling the segmentation mask and looking for disconnected islands of foreground with a small area.
Modeling and statistical analysis. The temporal evolution of measured features contains important information about spheroid dynamics and invasion. To measure dynamics, we provide mathematical modeling capabilities to fit models to temporal feature sequences. Three models are available for fitting: linear, quadratic, and exponential. Statistical testing can be performed to on the model parameters to determine if there are measurable differences in spheroid dynamics across experimental conditions. Comparisons between pairs of treatments are made using the student's t-test. Comparisons across two or more experimental conditions use the ANOVA test.
Visualization and reporting. TASI automatically generates visualizations and reports for image analysis, model fitting, and statistical analysis results. For each experimental condition, time plots of the features are generated along with confidence intervals to illustrate variance within the condition replicates (see Fig. 4). Feature plots and modeling can also be generated individually for each replicate in all experimental conditions (see Fig. S2).   As shown in Fig. S1, TASI enables users to analyze individual spheroids, or spheroids grouped by experimental conditions. TASI uses a simple folder structure to organize and group experimental conditions, and performs end-to-end analysis once the input and output folders have been identified. Currently TASI supports most common image formats (jpg, png, tiff and others). The outputs generated for each spheroid include segmentation masks, feature extraction images, and spreadsheet CSV files containing feature extraction data and image analysis parameters for reproducibility. Additional CSV files describing modeling parameters and optionally statistical tests are also generated in the base output folder.

Results
The spatio-temporal segmentation approach produces smooth segmentations of various spheroid morphologies (see Fig. 2a). By performing graph cuts simultaneously across both space (x, y) and time (t), the segmentation algorithm suppresses noise and produces segmentations that are smooth in both space and time. Dim branches and edges that are characteristic of invasive spheroid phenotypes can be segmented accurately using this approach by integrating information across time. The graph-cutting approach can also compensate for gradual decreases in spheroid intensity over time due to imaging, as compared to segmentation methods that establish a uniform threshold for all time.
Segmentation masks are automatically saved in the output folders for quality control, where segmentation boundaries are superimposed over the spheroid intensity images in videos. By examining the video, the users can quickly review the segmentation quality, and refine if necessary.

TASI analysis captures differences in spheroid phenotypes. Coordination between leader and fol-
lower cells in collective migration has been investigated, and key differences between leader and follower cells include cytoskeleton structure 43 and signaling pathway activations 29,44,45 . It is not clear, however, whether these complementary differences have a genetic basis or are induced by microenvironmental conditions. It is unknown, for example, if a follower cell becomes a leader when exposed to the spheroid/environment interface, or to what extent leader and follower phenotypes are transitory states that can be reversed. To answer these questions, we used TASI to analyze spheroids that were derived from purified leader or follower cells using SaGA.
The morphological differences between these spheroids are apparent in Fig. 2. Leader spheroids exhibit extensive chain-like branching, where the follower spheroids are compact and have more regular boundaries and sheet-like growth. The parental spheroids used to derive these populations are shown for comparison, and have intermediate morphologic qualities. Branch detection and core/invasive radius detection results for these spheroids are shown in Fig. 2b. The branch detection and radius finding algorithms work effectively across all spheroid types.
Temporal plots of key features are presented in Fig. 4 for each spheroid type. We noted from the interval in these plots that trends are remarkably stable for each spheroid type, with replicates from a given type exhibiting little variation, suggesting that the segmentation and feature extraction methods are robust. Significant differences exist were observed in how the features evolved over time for each spheroid type. Leader spheroids rapidly develop branches in the first 5 hours of growth and then reach a plateau, although the core radius continues to increase. The branch number for follower spheroids increases very slowly and consistently over 8 hours, and proportional to core radius (and hence spheroid circumference). The complexity of follower spheroids remains close to 1 for all time points, suggesting a spherical morphology. Trends for parental spheroids were similar to follower spheroids, with a slight shift towards a more invasive phenotype.
Model fitting and statistical testing of spheroid types. To further quantify differences in migration and growth between spheroid types, we fit models to the temporal sequences of each feature using least squares. Linear and exponential models are the most commonly used models for tumor growth, so we utilized these two models as well as a quadratic model to the sequences in Fig. 5. Fitted models are shown in Fig. 5. We noted that the R 2 values are generally high, ranging from 0.71 to 0.99. Linear models accurately describing the temporal evolution of follower and parental spheroids. The temporal evolution of the leader spheroids is much more complex, and was better fit by the quadratic models in most cases (adjusted R 2 ranges 0.71-0.99). The branch number and complexity dynamics of the leader spheroids are an exception, and are not described well by any model (adjusted R 2 ranges 0.58~0.90).
We performed statistical tests on these models to further quantify differences between the three spheroid types (see Table 2). The summary of the statistical test results among three cell lines is listed in Table 2. The features with the most significant differences in model parameters included area (linear model, ANOVA p = 3.40e-7), complexity (quadratic model, p a = 9.88e-8, p b = 7,16e-10), and perimeter (quadratic model, p a = 7.96e-6, p b = 3.93e-9). Eccentricity and single cell number had the weakest differences across spheroid types. The statistical tests confirmed our aim of defining unique features to classify different collective migration patterns.

Discussion
The application of TASI image analysis to spheroid data obtained by SaGA illustrates how spheroid cultures and image analysis can be used to investigate tissue microenvironments and their role in cancer invasion and metastasis. TASI contributes an end-to-end software approach for characterizing spheroid growth and invasion dynamics, providing image segmentation, feature extraction, modeling, and statistical analysis capabilities within the same tool. As an open source framework, it can readily be extended and tailored to the specific needs of investigators.
Our analysis of spheroids derived from purified leader and follower cells 38 used features like branch tip count and core radius to reveal important differences in growth and invasion. Leader and follower cells likely play complementary roles in establishing viable metastases distant from the primary tumor, and understanding this process and the differences in these cell phenotypes can lead to better targeting of these important mechanisms in the future. Growth and invasion are by definition dynamic processes, and by providing a framework to measure dynamic behaviors of spheroids, TASI enables precise and quantitative characterization of spheroid behavior. The ability to model these behaviors and to perform statistical tests between experimental conditions could aid in screening drugs or functional genetics studies by detecting subtle differences in dynamic behavior as opposed to static morphology. Objectivity and repeatability in these types of experiments is increasingly critical, and with large amounts of data, traditional manual quantification may not be practical.
Although our software provides new capabilities for spheroid analysis, the proposed approaches and validation have important limitations. TASI currently uses a projection operation to convert 3-dimensional image sequences to 2-dimensional to simplify image analysis. In the future we plan to extend the image analysis algorithms in TASI to perform three-dimensional temporal imaging (x, y, z + time) of spheroid cultures. Adding the z-dimension requires extending the graph-cutting segmentation to 4-dimensional volumes, and implementing features like surface area calculation and 3-dimensional skeletonization and branching analysis. Despite flattening 3-dimensional volumes to two dimensions, TASI is able to measure clear and statistically significant differences in our leader/follower/parental spheroids. Extending TASI to leverage existing cell tracking algorithms is another important direction for future development. Tracking will enable more detailed analysis of the movement patterns of leader cells, and more complex characterizations of the constituents in chain-like projections. Although the leader/follower/parental spheroids used in our study represent a broad spectrum of spheroid dynamics and morphologies, applying TASI to other spheroid models remains an important goal to provide additional validation of our software.