OBSC Analysis Pipeline
Description
Functional Precision Medicine platforms, which investigate the dynamic behavior of a patient’s tumor ex vivo to inform personalized treatment, face unique obstacles to clinical translation. These include limited access to patient tissue and stringent demands for intra-platform accuracy and consistency. In this study, an automated data analysis pipeline addresses these concerns for the Organotypic Brain Slice Culture functional assay by combining computer vision and dose-response modeling approaches. A 99% reduction in analysis time increases the amount of patient tissue that can be processed on the platform. Comparing automated measurements to previously published manual results revealed that automation increased consistency both within experiments and across replicate experiments. This pipeline also explores implementing complex CV with limited resources, modeling a unique and diverse dataset, and validating automated analysis when no gold standard measurements exist, obstacles that hinder automation efforts across scientific disciplines.
Files
Steps to reproduce
The image analysis pipeline was written in Python v3.10. The packages NumPy and Pandas were used extensively for storage and manipulation of data. OpenCV provided functions for image analysis. Scikit-image was used for image thresholding: 0ften, we needed to perform thresholding only on a specific segment of an image; we could pass the “masked” parts of the image directly to the threshold functions in Scikit-image without any further formatting of the data. An Object-Oriented Programming (OOP) approach was used to orchestrate the various steps of image analysis. Different image types each had their own class, with custom measurement and data storage methods for each. An Experiment class was used to organize the various images present in an image. It also included methods that measured the various images present and handled Biodock API calls. OOP made development smooth, as custom functionality was built around the elements of the OBSC assay. Individual methods could be tweaked in class definitions without altering the overall performance of the pipeline. We used Biodock to train an ML model to recognize OBSCs in grayscale images. Biodock guides users through multiple rounds of labeling and testing. Our final ML model was trained on 110 images containing 1037 OBSCs, all images being gathered from experiments that were not part of the data set used for validation in this paper. 99 images were used for model training, while 11 were reserved for model validation. The following data augmentations were applied: random horizontal flip, random vertical flip, random brightness, random contrast, random rotation, and random rescale. These augmentations improved the robustness of the resultant ML model when applied to new datasets. Contrast normalization was also applied. Images were uploaded to Biodock via their API protocol. API was also used to monitor the progress of new mask generation and to download mask results when they were ready. Biodock provides a UI for reviewing masks and editing and errors. Our pipeline allowed users to verify the results on Biodock and make any necessary edits before downloading the OBSC masks. OBSC masks were sorted into separate wells based on the location of each mask. This accomplished by dividing the image into a grid, since the absolute locations of the wells were consistent from image to image. The top mask in each well was measured before the bottom mask. For OBSC toxicity experiments, the OBSC masks were used to directly measure average fluorescence from each OBSC. For Tumor toxicity experiments, the OBSC masks had to be split in two. This was accomplished by using a function in OpenCV that found rotated bounding boxes. A line was drawn down the center of these rotated boxes, dividing the OBSC mask into two hemispheres. Each hemisphere was analyzed separately by Triangle Thresholding, determining a threshold for each hemisphere that distinguished tumor signal from background.
Institutions
- University of North Carolina at Chapel Hill