JoVE Logo

Sign In

In This Article

  • Summary
  • Abstract
  • Introduction
  • Protocol
  • Results
  • Discussion
  • Disclosures
  • Acknowledgements
  • Materials
  • References
  • Reprints and Permissions

Summary

This article describes step-by-step methods to automate image-based nuclei quantification using an open-source executable program validated across a range of cell densities. This program provides an alternative that addresses barriers related to cost, accessibility for users with limited technological skillsets, and application-specific validation that may limit utility of existing technologies.

Abstract

Live cell assays and image-based cell analyses require data normalization for accurate interpretation. A commonly used method is to stain and quantify nuclei, followed by data normalization to nuclei count. This nuclei count is often expressed as cell count for uninucleate cells. While manual quantification can be laborious and time-consuming, available automated methods may not be preferred by all users, may lack validation for this specific application, or may be cost-prohibitive. Here, we provide step-by-step instructions for capturing quantifiable images of nuclei stained with fluorescent DNA stains and subsequently quantifying the nuclei using an automated object counting software program developed using Python computer vision libraries. We also validate this program across a range of cell densities. Although the exact time for program execution varies based on the number of images and computer hardware, this program consolidates hours of work counting nuclei into seconds for the program to run. While this protocol was developed using images of fixed, stained cells, images of stained nuclei in live cells and immunofluorescence applications can also be quantified using this program. Ultimately, this program provides an option that does not require a high degree of technological skill and is a validated, open-source alternative to aid cell and molecular biologists in streamlining their workflows, automating the tedious and time-consuming task of nuclei quantification.

Introduction

Functional and image-based experiments are critical for understanding the impacts of experimental treatments on whole-cell biochemistry and physiology. Valid interpretation of data from cell biology experiments depends on the accuracy and reproducibility of the experimental protocol, including data normalization. For example, analyses of oxygen consumption and extracellular acidification rates in live cells at baseline and after treatment with specific drugs allow for the assessment of various aspects of energy metabolism1,2. Measuring the activity of enzymes such as lactate dehydrogenase in the supernatant of cell cultures can aid in quantifying cell membrane integrity3. Staining cultured cells with annexin V and propidium iodide before fixation allows for the assessment of apoptotic and necrotic cells4. However, differences in cell density across wells affect the results of each of these assays. Relying solely on seeding density could provide misleading results due to errors in counting cells for seeding, variations in cell density in media while plating, or different rates of cell growth between samples or treatments throughout experiments. Therefore, normalization of experimental results is required.

Current normalization methods for functional and image-based cell data include protein concentration5 or nuclei or cell count6. To normalize data to protein concentration, cells must be extracted in equal volumes of lysis buffer with protease inhibitor after the assay is run, and an additional assay (e.g., bicinchoninic acid assay, Bradford assay, etc.) must be performed for protein quantification. The accuracy of this method relies on complete cell extraction; leaving any protein behind contributes to errors in quantification. Counting nuclei or cells provides an alternative where no cells need to be removed from the surface on which they are grown. Instead, live or fixed cells are stained or counter-stained using colorimetric or fluorescent stains, and counting can be performed based on images of whole cells or only nuclei. Quantifying nuclei is preferred over whole cells for fluorescence microscopy applications and to normalize data in fused cells (e.g., myotubes) or tissues. For quantification of nuclei using a fluorescence approach, fluorescent DNA dyes (e.g., 4′,6-diamidino-2-phenylindole dichloride (DAPI), Hoechst 33342, Hoechst 33358, DRAQ5, etc.) are applied to live or fixed cells and imaged using fluorescence microscopy. DAPI, Hoechst, and DRAQ5 preferentially bind to adenine-thymine-rich regions of DNA7,8,9, providing a means for detecting nuclei. Optimization of dye concentration prevents off-target binding (i.e., to mitochondrial DNA, causing punctate cytosolic fluorescence)10. The optimization process can be streamlined by using commercially available mounting media containing DAPI for fixed cells (e.g., VECTASHIELD Antifade Mounting Medium with DAPI) and published concentrations of stains for live cells (e.g., Hoechst)6,11,12. Once stained, nuclei in live or fixed cells are visualized using the appropriate excitation filter (e.g., ultraviolet [DAPI and Hoechst] or far-red [DRAQ5]). Excitation maxima for DAPI, Hoechst, and DRAQ5 are at either end of the spectrum for fluorescence microscopy. This attribute, plus the DNA specificity of these dyes and their use at optimal concentrations, minimizes off-target fluorescence. The resulting images show bright nuclei against a black background, and these nuclei are quantified as a measure of cell number for uninucleate cells. While other accurate stain-based methods of nuclei quantification exist using histological stains and brightfield microscopy13, automation is more difficult, albeit possible, using those approaches.

While it remains the gold standard, manual nuclei quantification is laborious, time-consuming, and susceptible to potential human error with prolonged counting. Although automated cell counting programs exist, they are not preferred by all users, may be cost-prohibitive, and validation for specific applications may be minimal. Python has become a valuable and accessible resource for biologists in recent years. Python computer vision libraries are particularly useful for image analysis14. Here, we provide step-by-step instructions for using our executable program developed using Python code to quantify nuclei stained with fluorescent dyes and imaged using fluorescence microscopy. Coding skills are not necessary to use the program described here. This workflow is specific to cells or tissues with fluorescent DNA dyes applied. It is not intended for use with brightfield images. Section 1 describes how to capture and save images collected using fluorescence microscopy in a manner compatible with this workflow. Section 2 provides instructions for running the nuclei quantification program as an executable and fetching output. The executable program can be run directly from the .exe file provided and requires no modifications to quantify nuclei in quality images. This executable requires a Windows-based PC. Section 3 provides instructions for running the program as a Python script rather than an executable (required for Mac- or Linux-based systems, optional for Windows-based systems) and allows for tuning the code if desired. Section 4 describes how to use the results for normalization. These protocols are followed by representative results, including validation data from our laboratory.

Protocol

NOTE: Supplemental files can be found at the following link https://osf.io/a2s4d/?view_only=2d1042eb8f7c4c4a84579fe4e84fb03c

1. Capturing and saving images using fluorescence microscopy

  1. Prepare cell or tissue samples to be imaged, including staining with desired DNA dye. To obtain the images used here, C2C12 myoblasts (CRL-1772, American Type Culture Collection) were grown in 6-well plates for 48-72 h under standard culture conditions (5% CO2, 37 °C, humidified), with or without 50 mM EtOH6, and fixed in ice-cold methanol as previously described13. Fixed cells were mounted using a DAPI-containing mounting medium15 and dried in the dark before imaging.
  2. Turn on all components of the fluorescence microscope and computer according to established standard operating procedures. Open the software associated with the microscope.
  3. Set the microscope to visualize samples through the eyepiece. Check the objective. If needed, turn the nosepiece to the desired objective. Ensure the software program has the desired objective selected for an accurate indication of the image area. Here, images were captured using a 10x objective.
  4. With the lights off, place the sample (slide, plate, or dish) on the stage. Turn on live imaging with the appropriate filter and set exposure time either to a pre-determined duration or to automatic exposure. Here, DAPI filter and exposure time of 61-62 ms was used. See the troubleshooting table for guidance on setting exposure time, especially for images with high cell densities.
  5. Using the eyepiece slowly adjust the focus using the gross adjustment knob until stained nuclei are visible, then use the fine adjustment knob to slowly adjust the focus until nuclei appear clear and crisp.
    NOTE: Examples of appropriate images are shown in Figure 1.
    1. If excessive background staining appears or if nuclei appear very dim, adjust exposure time manually. In a single image, there may be visible differences in signal intensity for some nuclei; however, the round shape should be visible for all nuclei with minimal signal interference.
      NOTE: The program used in downstream applications is robust to different intensities. Raw images used for the development and validation of the nuclei quantification program include images with a range of signal intensities and are available through the Open Science Framework repository (see link mentioned above).

figure-protocol-2727
Figure 1: Example images of DAPI-stained nuclei. These images depict nuclei at (A) low, (B) medium, or (C) high cell densities with minimal background. Note the varying signal intensity of nuclei across image C; this did not interfere with quantification. Scale bar (C) indicates 100 µm; scale bars should be omitted from images used for nuclei quantification. Please click here to view a larger version of this figure.

  1. Once the nuclei are in focus through the eyepiece, switch the detection mode to the camera. Tune the focus using the fine adjustment knob.
  2. Adjust exposure time if needed. Note the final exposure time for use with subsequent samples and images.
    NOTE: Although using the same exposure time across all images is ideal, variations in exposure time are acceptable for this application because fluorescence intensity is not quantified or compared across samples.
  3. Capture the image using the appropriate image capture button on the software. If samples have multiple stains applied, switch the filter (e.g., to FITC, TRITC, or Cy5) and image the same area for merging purposes.
  4. Apply the shutter to minimize sample exposure to light. Without burning in a scale bar, save the image in a universal figure file format (.tif, .png, or .jpg) in a dedicated folder. Ensure that each image file name is appropriately descriptive or that any coding used for file names has appropriate linked documentation.
    NOTE: This will become the Image Directory for the quantification program. If multicolor imaging was used, copy only images of nuclei to a separate, dedicated folder. This can also be done at the end of the imaging session. Images exported using default export settings on most imaging software are typically of sufficient resolution for use with this program, provided that quality images have been captured. However, the images should be visually checked after export to ensure that the morphology of nuclei are clear. If images are saved in .jpg format, care should be taken to ensure that images are not excessively compressed, and quality is maintained.
  5. Open shutter, return to live imaging, and scan across the sample to another location for imaging. Repeat steps 1.8-1.9 as needed. For images of cells seeded in 6-well plates captured at 10x magnification, capture 10-15 images per well (depending on the consistency of cell density across the sample area).
  6. After all images for a single sample are acquired, perform one of the following options.
    1. Move on to the next sample and repeat steps 1.4-1.10.
    2. Pause the protocol and return at another time. Samples should remain protected from light. This option is not recommended if working with live cells.
  7. Once imaging is complete, ensure all samples are light-protected before turning the room lights on. If the folder containing images is saved locally, transfer files to a thumb drive, cloud storage location, or other network drive accessible to the computer where the quantification program will be run. Save in a dedicated folder.
  8. Shut off all parts of the microscope and computer according to established standard operating procedures.
  9. Imaging is now complete. Analyze the files using the automated quantification program as described in Section 2 or, alternatively, by running the program as a Python script as described in Section 3.

2. Running the automated nuclei quantification program as an executable

NOTE: This method, running the program as an executable, is compatible with Windows-based PCs and is the recommended method for Windows OS users. Mac OS or other non-Windows users should run the program as a Python script (see Section 3).

  1. Ensure Python is installed on the computer. If needed, install Python from python.org/downloads (preferred) or by using Anaconda or Miniconda. As of the date of publication, this program has been tested with Python versions 3.10-3.12.
  2. Open the browser and navigate to https://github.com/rbudnar/nuclei_counter/releases. Download the latest version of the file named count_nuclei.zip.
  3. From the Downloads folder, right-click on the Zip file and Extract All files to the desired location on the local computer (see Figure 2A). Keep this file location open; this file path will be used in step 2.5 (see Figure 2B).
    NOTE: Count_nuclei should now appear as an application file. This is the executable file.
  4. Open a command prompt by searching CMD or Command Prompt in the search bar. Use the cd command to change the directory to the file path for the executable file (see Figure 2C) and press Enter. Example command line: C:\Users\janedoe>cd [space after cd, then copy/paste file path]
  5. On the next command line, type the following and press Enter.
    count_nuclei.exe --img_dir "path/to/images" --output_dir "path/to/output" --save_images --output_count_filename "results.csv"
    where path/to/images is the file path to the folder containing images to be analyzed (see step 1.14); path/to/output is the file path to the folder where the .csv file should be saved (defaults to current working directory when not provided); and results.csv is the file name that the resulting counts will be saved to (if not provided, the output file name defaults to count_results.csv).
    NOTE: Quotation marks are needed in the command line. Ensure there are no spaces after quotation marks before the file path (see Figure 2C).
  6. When the next command line appears, the processing is complete. The contours and the results spreadsheet are now available in the location specified as the output directory in step 2.5 (i.e., path/to/output; see Figure 2C).
  7. Visually inspect the contours to verify count quality. Results can now be used to normalize data as described in Section 4.
    NOTE: If contours appear to have missed nuclei (e.g., nuclei appear too faint) or cluster groups of nuclei into a single item (e.g., over-exposed image, too much background, artifacts), the user should refer to the troubleshooting table and may need to return to Section 1 to optimize image acquisition before moving on to Section 4.

figure-protocol-9660
Figure 2: Examples of key parts of the workflow for section 2. (A) Extract files from the Downloads folder, taking care to click on the correct folder as indicated by the arrow to enable extraction (B) to the desired destination in step 2.3. (C) Examples of commands for steps 2.4 and 2.5 and the next command line indicating completion in step 2.6. Note that the file path in step 2.4 (C) matches the location for extraction in step 2.3 (B). Please click here to view a larger version of this figure.

3. Running the automated nuclei quantification program as Python script

  1. Ensure Python is installed on the computer. If needed, install Python from python.org/downloads (preferred) or by using Anaconda or Miniconda. As of the date of publication, this program has been tested with Python versions 3.10-3.12.
  2. Open the browser and navigate to https://github.com/rbudnar/nuclei_counter. Click the Green Code button, then click Download ZIP to download the code repository (see Figure 3A).
  3. Use the following instructions for Windows OS. See step 3.4 for Mac OS-based machines.
    1. From the Downloads folder, right-click on the File and select Extract All to extract the files to a local computer (see Figure 3B-C).
    2. In the extracted file location, open the folder named nuclei_counter-main. This is the code repository.
      NOTE: This only needs to be downloaded the first time this program is used; simply move the extracted files to an accessible network location and make note of that location.
    3. Open a command prompt by searching CMD or Command Prompt in the search bar. If Python has been installed by Anaconda or Miniconda, open the Anaconda Prompt instead of a standard command prompt. This can be found by typing Anaconda Prompt in the search bar.
    4. Use the cd command to change the directory to the code repository and press Enter. See the line of code below, which is case-sensitive. Ensure that the folder named nuclei_counter-main is open when copying the file path; the file named pyproject or pyproject.toml should be visible (see Figure 3D). Example command line: C:\Users\janedoe>cd [space after cd, then copy/paste file path]
    5. On the next command line, type the following, including the space and period (see Figure 3D:
      pip install -e .
      NOTE: Steps 3.3.5 and 3.3.6 only need to be completed the first time this program is run on any computer. If this has already been completed, proceed to step 3.3.7. The installation process may take a few moments to initialize.
    6. Press Enter. Running this command installs required libraries to run this script and installs the repository in an editable mode in the event code adjustments are needed (see Figure 3D).
    7. Type the following into the next command line to change the directory to the main source code directory (see Figure 3E):
      cd "nuclei_counter"
    8. On the next command line, type the following and press Enter (see Figure 3E):
      python count_nuclei.py --img_dir "path/to/images" --output_dir "path/to/output" --save_images --output_count_filename "results.csv"
      Where path/to/images is the file path to the folder containing images to be analyzed (step 1.14); path/to/output is the file path to the folder where the .csv file should be saved (defaults to current working directory when not provided); and results.csv is the file name that the resulting counts will be saved to (if not provided, the output file name defaults to count_results.csv).
      NOTE: Quotation marks are needed in the command line. Ensure there are no spaces after quotation marks before the file path. The python script will read the files in the provided file path and execute the nuclei counting program for all the images in the directory (see Figure 3E). The resulting counts will be saved to the results .csv file in the location specified.
    9. When the next command line appears, the processing is complete (see Figure 3E). The contours and the results spreadsheet are now available in the location specified as the output directory in step 3.3.8 (i.e., path/to/output).

figure-protocol-14708
Figure 3: Examples of key parts of the workflow for section 3 using Windows OS. To access the code, click the green button labeled Code and (A) download the Zip file (indicated by arrows). (B) Extract by right-clicking on the Zip file (shown in blue) and (C) setting the desired destination. (D) After opening the command prompt, examples of commands for steps 3.3.4 and 3.3.5. Note that the command for step 3.3.5 is all on one line; the text beginning "Obtaining file" on the next line appears after pressing enter (step 3.3.6; i.e., running the command). (E) Examples of commands for steps 3.3.7 and 3.3.8, a progress bar following execution of step 3.3.8, and the command line showing completion in step 3.3.9. Please click here to view a larger version of this figure.

  1. Use the following instructions for Mac OS.
    1. From the Downloads folder, click on the File menu and select Open to extract the files to local computer (see Figure 4A).
    2. In the extracted file location, open the folder named nuclei_counter-main. This is the code repository.
      NOTE: This only needs to be downloaded the first time this program is used; simply move the extracted files to an accessible network location and make note of that location.
    3. Open a terminal by pressing command+space bar which opens spotlight; then, search "terminal".
    4. Use the cd command to change the directory to the code repository and press Enter. See the line of code below, which is case-sensitive. Type the file path out in a text document and copy it into the terminal. Ensure the file path begins with the text immediately preceding cd (e.g., /Users/userid in Figure 4B). Example command line: /Users/janedoe›cd /Users/janedoe/Desktop/nuclei_counter-main
    5. On the next command line, a dollar sign will appear after the User ID (see Figure 4B). Ensure that there is a space after the dollar sign, and type the following, including the space and period at the end of the command. Include the appropriate Python version immediately after pip without a space: pip3 install -e .
      NOTE: Steps 3.4.5 and 3.4.6 only need to be completed the first time this program is run on any computer. If this has already been completed, proceed to step 3.4.7. The installation process may take a few moments to initialize.
    6. Press Enter. Running this command installs required libraries to run this script and installs the repository in an editable mode in the event code adjustments are needed.
    7. On the next command line, ensure that there is a space after the dollar sign, then type the following to change the directory to the main source code directory (see Figure 4C):
      cd "nuclei_counter"
    8. On the next command line, type the command line below. Replace the number after Python with the correct version number if using a version other than 3. Then, press Enter (see Figure 4C):
      python3 count_nuclei.py --img_dir "path/to/images" --output_dir " path/to/output" --save_images --output_count_filename "results.csv"
      where path/to/images is the file path to the folder containing images to be analyzed (step 1.14); path/to/output is the file path to the folder where the .csv file should be saved (defaults to current working directory when not provided); and results.csv is the file name that the resulting counts will be saved to (if not provided, the output file name defaults to count_results.csv).
      NOTE: Quotation marks are needed in the command line. Ensure there are no spaces after quotation marks before the file path. The Python script will read the files in the provided file path and execute the nuclei-counting program for all the images in the directory (see Figure 4C). The resulting counts will be saved to the results .csv file in the specified location.
    9. When the next command line appears, the processing is complete (see Figure 4C). The contours and the results spreadsheet are now available in the location specified as the output directory in step 3.4.8 (i.e., path/to/output).
  2. Visually inspect the contours to verify count quality. Results can now be used to normalize data as described in Section 4.
    NOTE: If contours appear to have missed nuclei (e.g., nuclei appear too faint) or cluster groups of nuclei into a single item (e.g., over-exposed image, too much background, artifacts), the user should refer to Table 1 and may need to return to Section 1 to optimize image acquisition before moving on to Section 4.

figure-protocol-20070
Figure 4: Examples of key parts of the workflow for section 3 using Mac OS. After downloading the code (see Figure 3A), (A) extract by clicking on the Zip file (shown in blue) and setting the desired destination. (B) After opening the terminal, examples of commands for steps 3.4.4 (changing the directory to the code repository) and 3.4.5 (installing pip). (C) Examples of commands for steps 3.4.7 and 3.4.8, a progress bar following execution of step 3.4.8, and the command line showing completion in step 3.4.9. Please click here to view a larger version of this figure.

4. Using counts to normalize experimental data

  1. Open the results.csv file linking each image with nuclei quantification determined using the automated program.
  2. Decide on the method of normalization: 1) image-by-image basis (e.g., if multicolor fluorescence microscopy), 2) normalize data as a ratio of the average nuclei count per sample versus a reference sample (or condition), 3) normalize to nuclei count per sample (e.g., extrapolate total nuclei count to sample area). Recommendations for the method of normalization are in the Discussion section.
    1. If normalization will be performed on an image-by-image basis, simply divide experimental data for each image by the number of nuclei for that image.
    2. To normalize data as a ratio, follow the steps described below.
      1. For any samples where multiple images were collected for a single replicate (e.g., 10-15 images captured from a single well in a 6-well plate), calculate the average number of nuclei per image. These nuclei counts are considered as the cell count assuming uninucleate cells or a number of cells fused together in multinucleate cells (such as with myotubes).
      2. Select either a reference sample or a reference condition (e.g., average count across all samples from the control condition) and note the count.
      3. Divide the count for all samples by that reference count, resulting in a normalization value. If a reference sample was used, use the normalization value for the reference sample as 1.
        NOTE: If a reference condition was used, the average normalization value across the condition would now be 1. Samples with fewer nuclei than the reference (i.e., less dense) will have normalization values less than 1, and samples with more nuclei than the reference (i.e., denser) will have normalization values greater than 1.
      4. Divide the experimental data for each well by the corresponding calculated normalization value.
    3. To normalize data to nuclei count per sample, follow the steps described below.
      1. For any samples where multiple images were collected for a single replicate (e.g., 10-15 images captured from a single well in a 6-well plate), calculate the average number of nuclei per image. These nuclei counts are considered as the cell count assuming uninucleate cells, or number of cells fused together in multinucleate cells (such as with myotubes).
      2. Determine the surface area of the slide (coverslip), well, or dish from which the data were derived. This information can be found in the specifications section on product websites.
      3. Determine the area of each captured image. This information is often available as metadata in the imaging or analysis software.
      4. Ensure the sample surface area and the image area are expressed in the same units (e.g., mm2). If not, convert to the desired unit.
      5. Calculate the total count for each sample using the following equation:
        TC = AC • (SA/IA)
        where TC is total count, AC is average count, SA is surface area, IA is image area.
      6. Divide experimental data by corresponding TC for the sample.
  3. Normalize experimental data and use for statistical analyses as appropriate.

Results

Each batch image run produces: 1) a set of image files with contours applied showing the outlines of identified nuclei (Figure 5), and 2) a .csv file (spreadsheet) linking image file names and the associated counts. Viewing the contours will allow the user to visually assess the count quality. Specifically, images obtained according to section 1 should have all (or nearly all) nuclei surrounded by a solid green line indicating that the nucleus was counted by the program. These contours were used to tune the program here.

figure-results-681
Figure 5: Examples of original images and corresponding contours. (A-C) Examples of original images before analysis and (D-F) corresponding contours after analysis directly below. Scale bar (C) indicates 100 µm; scale bars should be omitted from images used for nuclei quantification. Please click here to view a larger version of this figure.

Validation using initial results
C2C12 myoblasts at varying cell densities were methanol-fixed, counterstained with DAPI in mounting media, and 120 images were obtained at 10x magnification in .jpg file format. The automated program was run with the Image Directory set to the folder containing these images, and the resulting .csv file was saved. Separately, each image was manually quantified by two trained researchers who were blind to the automated counts and to each other's counts. Raw images, contours generated by the automated program, and a results spreadsheet including manual and automated counts are available in the Open Science Framework (OSF) repository (see link in section 1). Intraclass correlation coefficients (ICCs; average measures) were calculated using SPSS Statistics to determine interrater reliability between 1) the two manual counts and 2) the average of the two manual counts and counts obtained using the automated program. Similar approaches have been used to validate other programs designed to quantify objects in images obtained using fluorescence microscopy16,17,18. ICCs were also calculated between average manual counts and automated counts for each quartile to ensure that assessing the whole data set did not mask any potential changes in reliability based on cell density. Quartiles were defined using the 25th, 50th, and 75th percentile cut points based on average manual count, and range from quartile 1 (Q1; lowest cell density) to Q4 (highest cell density). ICCs are reported based on average measures and interpreted based on the following definitions: poor (ICC <0.50), moderate (0.50 ≤ICC <0.75), good (0.75 ≤ICC <0.90), or excellent (ICC ≥0.90)19.

Nuclei per image ranged from 44.5 to 1160 based on manual count averages. Interrater reliability was excellent between the two manual counts (ICC > 0.999, p < 0.0001; Figure 6A) and between average manual and automated counts (ICC = 0.993, p < 0.0001; Figure 6B). Reliability remained excellent across quartiles (Q1: ICC = 0.996, p < 0.0001; Q2: ICC= 0.997, p < 0.0001; Q3: ICC = 0.998, p < 0.0001; Q4: ICC = 0.986, p < 0.0001; Figure 6C-F). The single data point far from the best fit line in Figure 6B represents the image shown in Figure 7. The image has several areas of multiple nuclei grouped together, preventing the computer vision program from recognizing each nucleus. This problem can be fixed by using a shorter exposure time. Table 1 describes how to handle such an image.

figure-results-4382
Figure 6: Inter-rater reliability. Inter-rater reliability across the full data set (A) between manual rater counts and (B) between automated counts and average manual counts. (C-F) Inter-rater reliability between automated counts and average manual counts by quartile. Reliability expressed as intraclass correlation coefficient (ICC). Please click here to view a larger version of this figure.

figure-results-5136
Figure 7: Example of an image with two barriers to accurate nuclei quantification. (A) Original image and (B) associated contours. Arrow 1 indicates an area with multiple nuclei clumped together, distorting the round nuclear shape enough to impede software detection of multiple nuclei. This occurs in several locations throughout this image. Arrow 2 indicates a faded halo appearing behind multiple nuclei; this halo appeared bright enough for the software to include it as a nucleus, thereby losing the counts of the multiple nuclei it surrounds. This image represents the single data point far from the best-fit line in Figure 6B, emphasizing the potential problems with these barriers. Scale bar (A) indicates 100 µm; scale bars should be omitted from images used for nuclei quantification. Please click here to view a larger version of this figure.

Discussion

Our nuclei quantification program has several advantages over existing options: it requires only minimal technological skills, is validated for the specific task of nuclei quantification, and is open-source; the latter overcomes cost-related barriers. Ultimately, this program provides cell and molecular biologists with an additional option to quickly and accurately quantify nuclei in images captured using fluorescence microscopy. Currently available automated nuclei or cell counting programs are not preferred by all users, some are cost-prohibitive, and validation may be minimal or absent for specific applications. Specialized equipment, such as the BioTek Cytation line, is accompanied by technical bulletins validating in situ cell counting using nuclear staining20 in addition to a wide variety of additional applications. While validation data exists and the Cytation product line is widely used, especially when interfaced with Seahorse Extracellular Flux Analyzers to normalize live cell data easily and efficiently, this product can be cost-prohibitive for laboratories with limited equipment funding available. For example, the list price for the base model equipped with four objectives and four filter cubes for fluorescence microscopy exceeded $100,000 US dollars in the calendar year 2024. For those without the means to purchase specialized equipment, open-source software provides cost-free alternatives for image analysis. Open-source software useful for nuclei and cell quantification includes ImageJ (National Institutes of Health, Bethesda, MD, USA; available at 21. Plugins are now available for those who wish to write macro scripts for image processing automation using the ImageJ platform. ImageJ-based cell counting automation using phase contrast or brightfield microscopy with whole-cell images has been previously described22,23. CellProfiler is a widely published application for analysis of cell images stained with fluorescent dyes or standard histological stains, and an early article describing its utility across a range of biological applications is often cited as validation24. However, this manuscript does not validate any particular biological finding, necessitating additional validation and transparency for various automation pipelines used, such as for nuclei counting25. Moreover, while CellProfiler is an efficient software package for cell analysis, not all scientists find it user-friendly. Therefore, we aimed to develop and validate an alternative automated program to quantify nuclei using open-source software. Specifically, we employed existing computer vision libraries in Python to develop this workflow.

This method begins with cells or tissues the end-user has stained using DNA stains such as DAPI26. General guidelines for capturing and saving images in a manner compatible with automation software are provided. Although details may differ with different microscopes and imaging software, the general workflow for section 1 is the same to obtain quantifiable images. If using live samples, care must be taken to ensure appropriate personal protective equipment is worn and the imaging environment is appropriate for those samples (e.g., temperature, percentage of CO2, addition of buffer, etc.)27. While this protocol describes imaging of only the DNA dyes, users can capture other colors of the same area for merging purposes15, and simply copy the nuclear images into a separate folder for use with the quantification program. Imaging should be performed in a dark room with appropriate PPE for live samples and proper disinfection should be used as needed (e.g., with 70% ethanol). Stained samples should be protected from light prior to turning the lights on. Quality image capture is critical for accurate nuclei quantification. Even in images with appropriate exposure time and strong contrast between bright nuclei and a black background, the presence of excessively clumped cells or halos behind groups of cells (see Figure 7) may decrease quantification accuracy. In these cases, exposure times may need to be altered to decrease the intensity of signals, ensuring minimal merging of nuclei signals and minimization of halos while maintaining a strong enough signal to detect the round shapes of nuclei. If those steps are insufficient, imaging an adjacent section of the sample may be necessary. All images for a single experiment must be captured at the same magnification, and the magnification corresponding to the objective used must be properly set in the imaging software. It is especially critical that the objective used for imaging matches the settings on the imaging software when the nuclei count will be extrapolated from the imaged area to the whole well (or slide) area. This step should take place each time the objective is switched but is easily overlooked when setting up the microscope and software. The time required for section 1 varies based on a number of factors (e.g., user experience with fluorescence microscopy, number of images and samples, microscope, etc.). To capture 10-15 images of stained nuclei per well in two 6-well plates, the user should reserve approximately 1-2 h of time.

Once images have been captured and saved in a dedicated folder, they are ready to be quantified. The simplest method for quantification is running this pre-packaged automated program without needing to install Python or any libraries (section 2). It should be noted that the program is prepared as an executable and was packaged using Pyinstaller. Software built using Pyinstaller is commonly flagged by antivirus software. If antivirus software blocks the file from opening, the user should flag the file as safe to proceed. This is critical to successfully perform section 2. Alternatively, any user can opt to run the automated quantification program as a Python script (section 3) rather than an executable, if desired. If the user wishes to run the program using a Mac or Linux operating system, the program must be run through Python. This method does not require Pyinstaller but may be more technically challenging. The step-by-step protocol along with examples, detailed in section 3, aims to remove the technical barriers to running this program as a script. Whether section 2 or section 3 is used to run the program, it is critical to ensure that code is properly entered into command prompts. Example lines of code are included throughout the protocol, and the user should pay careful attention to spacing, quotation marks, and other punctuation. The user should also ensure that the file paths are accurate. It is helpful to have the file paths for the images and output available in a Word document. Commands can also be typed into this Word document and copy/pasted as needed.

As described in section 4, there are multiple approaches to normalize experimental data using counts obtained from this automated nuclei quantification program. For image-based experiments where experimental data include a number of events in each image and a proportion is desired (e.g., proportion of annexin V-positive cells28, the proportion of cells expressing ACE2 receptors29, number of cells that uptake stained particles30, etc.), the experimental data for each image can simply be divided by the resulting count (resulting in a proportion from 0 to 1). Then, the average proportion can be calculated across replicate images from the same slide, dish, or well. If a percentage is desired, simply multiply the final proportions by 100. Finally, these average proportions or percentages can be used in downstream statistical analyses. When the experimental data to be normalized are from functional experiments in live cells (e.g., oxygen consumption rates6,11,12) or from cell culture supernatant (e.g., lactate dehydrogenase activity in supernatant31 or concentration of a specific secreted cytokine32, etc.), the nuclei counts should first be averaged across all images captured from the same well. Then, the nuclei count can be extrapolated to the surface area of the slide (coverslip), well, or dish, or the count can be expressed as a ratio versus a reference sample or condition. Extrapolation to the surface area of the slide, well, or dish is useful to express experimental data versus the number of cells (if using uninucleate cells) from which the data were derived (e.g., oxygen consumed per min per 103 cells). To use this method, the surface area of the slide (coverslip), well, or dish and the area captured in each image must be known. If the sample does not cover the entire surface area available, the experimental data are from a small quantity of supernatant (i.e., expressed as activity or concentration per unit volume), or the image and/or surface area are not known, then the best option is to average nuclei counts across all images for a single sample and express the nuclei count relative to a reference sample or condition. The resulting value is used to correct experimental data for nuclei density or cell density (if using uninucleate cells).

While this method is simple to execute, there are several potential problems about which users should be cognizant. These potential problems, along with possible causes and troubleshooting steps to resolve the issues, are listed in Table 1. The program described here has key advantages compared to existing software; however, several limitations must be acknowledged. The main disadvantage is that the quantification program can only be used with images captured using fluorescence microscopy, not brightfield images. While DAPI-stained images captured at 10x magnification were used to build the program, the program can be used with other DNA dyes and magnifications since the program is built to recognize the morphology of the nuclei rather than color or size. While we validated the accuracy of the program on images containing a variety of cell densities, the end user may have cell densities that fall outside of the range. In this case, we still anticipate accurate counts provided that quality images are obtained; however, the user should carefully check the contours and output to ensure accuracy. For cell culture applications, quantification of nuclei in images is most appropriate for cells in a monolayer. If cultured cells overlap, nuclei may be masked, resulting in an underestimation of nuclei quantity. The two-dimensional nature of quantifying nuclei in images precludes the use of this program for determining the total number of nuclei from cells in suspension, thick tissue blocks, or other three-dimensional applications. However, this program can still quantify nuclei labeled with fluorescent DNA dyes in two-dimensional images captured from three-dimensional models such as thick tissue blocks. The utility of quantifying nuclei in images for the desired application should be determined by the end user.

ProblemPossible CausesPossible Solutions
Excessive background in imagesExposure time too highReduce exposure time
Nuclei appear to merge with each other in imagesFluorescent DNA dye concentration too high or too much DNA dye-mounting media Reduce dye concentration during optimization; use the least possible amount of mounting media
Nuclei appear too light or some nuclei are not visibleExposure time too lowIncrease exposure time
PhotobleachingPrevent photobleaching by ensuring stained samples remain stored in the dark and by minimizing exposure of samples to illumination (e.g., by using the minimum exposure time necessary and by turning off illumination when it is not needed such as after an image is captured or while taking notes)
Halo effects or non-nucleus-specific shapes appearingExposure time too highReduce exposure time
Lint from delicate task wipers or some benchtop protectors in live cells or adhering to fixed cellsEnsure a lint-free environment: minimize use of delicate task wipers when samples are exposed (e.g., in biosafety cabinet for live cells, during fixation and drying of fixed cells, or during staining process); ensure benchtop protectors do not leave lint on slides or plates during staining
Other abnormalities on surface of fixed cells/tissuesHandle samples with extreme care and follow proper precautions and best practices during fixing and staining
Disturbances in light pathEnsure all parts of the microscope are clean and free of lint and dust; clean outside of slides/plates/dishes with 70% ethanol to remove environmental dust and lint prior to imaging
Executable file will not openAntivirus software blocked the fileFlag the file as safe
Errors in command promptsProblems with spacing in command lineDouble check that the beginning of the command is typed immediately after the “>” symbol in the command line without a space, that no spaces are present after the open quotation marks for file paths, and that spacing and matches the code provided and the examples.
Improper cases used in command lineThe code is case-sensitive; be sure and use capital and lower-case letters as appropriate
Problems with file pathEnsure that the file path indicates the inside of the associated file folder (i.e., the file folder is open when the file path is copied).
Problems with the program that are not solved using the troubleshooting steps aboveSoftware or command line problems noted above.Submit an issue via GitHub. Navigate to  https://github.com/rbudnar/nuclei_counter. In the menu bar across the top, select “Issues” (second option, to the right of “Code”). Click the green button on the right-hand side that says “New Issue” to submit. There will be a prompt to login to GitHub before submitting the issue. There will also be an option to create a free account if needed.  

Table 1: Troubleshooting for capturing quality images and running the automated nuclei quantification workflow.

Overall, the methods described herein provide step-by-step details to use the automated nuclei quantification program that we developed using computer vision libraries and validated against manual counts from multiple raters. This program was developed to ensure usability by scientists with various levels of coding-related technological skills, is freely available, and was validated specifically for the task of nuclei quantification. Compared with manual counting, this program will save the end user valuable time and provide accurate and reliable nuclei counts for data normalization.

Disclosures

The authors declare no conflicts of interest.

Acknowledgements

Funding for this work was provided by the National Institutes of Health/National Institute on Aging (R01AG084597; DEL and HYL) and by start-up funds from Texas Tech University (DEL). The authors would like to thank the Texas Tech University Undergraduate Research Scholars and TrUE Scholars programs for providing financial support to the undergraduate researchers who contributed to this work (REH, MRD, CJM, AKW). We also thank Drs. Lauren S. Gollahon and Michael P. Massett for graciously sharing their laboratory space and equipment.

Materials

NameCompanyCatalog NumberComments
Computer with access to results file from method 2 or 3--See step 2.6 (for Method 2) or step 3.3.9 or 3.4.9 (for Method 3)
Computer with internet access, modern browser--e.g., Google Chrome
Computer with internet access, modern browser, and Windows OSVariesVariesFor Mac, Linux, or other OS, use Method 3
Computer with software for image captureZeissAxioVisionOther software is acceptable; must be compatible with the fluorescence microscope
File location for output (results spreadsheet and image contours)--Can be a new, empty folder
Fluorescence microscopeZeissAxiovert 200MOther fluorescence microscopes are acceptable; must be equipped with appropriate filter cubes, desired objective, and camera 
Folder containing all images to be quantified--See step 1.12
Python version 3.10 or higherPython-Available for free download and installation at https://www.python.org/downloads/ 
Samples to be imaged--Fixed or live, stained or counterstained with fluorescent DNA dyes
Spreadsheet softwareMicrosoftExcelSimilar spreadsheet software is also acceptable

References

  1. Chacko, B. K., et al. The bioenergetic health index: A new concept in mitochondrial translational research. Clin Sci. 127 (6), 367-373 (2014).
  2. Desousa, B. R., et al. Calculation of ATP production rates using the Seahorse XF Analyzer. EMBO Rep. 24 (10), e56380(2023).
  3. Rayamajhi, M., Zhang, Y., Miao, E. A. detection of pyroptosis by measuring released lactate dehydrogenase activity. Inflammasome. 1040, 85-90 (2013).
  4. Baskic, D., Popovic, S., Ristic, P., Arsenijevic, N. Analysis of cycloheximide-induced apoptosis in human leukocytes: Fluorescence microscopy using annexin V/propidium iodide versus acridin orange/ethidium bromide. Cell Biol Int. 30 (11), 924-932 (2006).
  5. Duplanty, A. A., Siggins, R. W., Allerton, T., Simon, L., Molina, P. E. Myoblast mitochondrial respiration is decreased in chronic binge alcohol administered simian immunodeficiency virus-infected antiretroviral-treated rhesus macaques. Physiol Reps. 6 (5), e13625(2018).
  6. Levitt, D. E., Bourgeois, B. L., Rodríguez-Graciani, K. M., Molina, P. E., Simon, L. Alcohol impairs bioenergetics and differentiation capacity of myoblasts from Simian immunodeficiency virus-infected female Macaques. Int J Mol Sci. 25 (4), 2448(2024).
  7. Larsen, T. A., Goodsell, D. S., Cascio, D., Grzeskowiak, K., Dickerson, R. E. The structure of DAPI bound to DNA. J Biomol Str Dyn. 7 (3), 477-491 (1989).
  8. Bazhulina, N. P., et al. Binding of Hoechst 33258 and its derivatives to DNA. J Biomol Str Dyn. 26 (6), 701-718 (2009).
  9. Njoh, K. L., et al. Spectral analysis of the DNA targeting bisalkylaminoanthraquinone DRAQ5 in intact living cells. Cytomet A. 69A (8), 805-814 (2006).
  10. Hamada, S., Fujita, S. DAPI staining improved for quantitative cytofluorometry. Histochemistry. 79 (2), 219-226 (1983).
  11. Levitt, D. E., Chalapati, N., Prendergast, M. J., Simon, L., Molina, P. E. Ethanol-impaired myogenic differentiation is associated with decreased myoblast glycolytic function. Alcohol Clin Exp Res. 44 (11), 2166-2176 (2020).
  12. Levitt, D. E., et al. Skeletal muscle bioenergetic health and function in people living with HIV: association with glucose tolerance and alcohol use. Am J Physiol Regul, Integ Comp Physiol. 321 (5), R781-R790 (2021).
  13. Levitt, D. E., Adler, K. A., Simon, L. HEMA 3 staining: A simple alternative for the assessment of myoblast differentiation. Curr Prot Stem Cell Biol. 51 (1), e101(2019).
  14. Solem, J. E. Programming computer vision with Python. , O'Reilly. Sebastopol, CA. (2012).
  15. Delery, E. C., Levitt, D. E., Amedee, A. M., Molina, P. E., Simon, L. High fat, high sucrose diet promotes increased expression of ACE2 receptor in the SIV-infected host: implications for SARS-CoV-2 infection. Front Nutrition. 11, 1458106(2024).
  16. Corrà, M. F., et al. Advantages of an automated method compared with manual methods for the quantification of intraepidermal nerve fiber in skin biopsy. J Neuropathol Exp Neurol. 80 (7), 685-694 (2021).
  17. Neves, K., et al. The reliability of the isotropic fractionator method for counting total cells and neurons. J Neurosci Meth. 326, 108392(2019).
  18. Tiong, K. H., et al. QuickCount: a novel automated software for rapid cell detection and quantification. BioTechniques. 65 (6), 322-330 (2018).
  19. Koo, T. K., Li, M. Y. A guideline of selecting and reporting intraclass correlation coefficients for reliability research. J Chiropractic Med. 15 (2), 155-163 (2016).
  20. Kam, Y., Jastromb, N., Clayton, J., Held, P., Dranka, B. P. Normalization of Agilent Seahorse XF Data by in situ. cell counting using a BioTek Cytation 5. , https://www.agilent.com/cs/library/applications/5991-7908EN.pdf 5991-7908 (2017).
  21. Schneider, C. A., Rasband, W. S., Eliceiri, K. W. NIH image to imageJ: 25 years of image analysis. Nat Meth. 9 (7), 671-675 (2012).
  22. O'Brien, J., Hayder, H., Peng, C. Automated quantification and analysis of cell counting procedures using ImageJ plugins. J Vis Exp. (117), e54719(2016).
  23. Grishagin, I. V. Automatic cell counting with ImageJ. Anal Biochem. 473, 63-65 (2015).
  24. Carpenter, A. E., et al. CellProfiler: image analysis software for identifying and quantifying cell phenotypes. Genome Biol. 7 (10), R100(2006).
  25. Tollemar, V., et al. Quantitative chromogenic immunohistochemical image analysis in cellprofiler software. Cytometry A. 93 (10), 1051-1059 (2018).
  26. Chazotte, B. Labeling nuclear DNA using DAPI. Cold Spring Harbor. 2011 (1), (2011).
  27. Cole, R. Live-cell imaging. Cell Adhesion Migrat. 8 (5), 452-459 (2014).
  28. Rieger, A. M., Nelson, K. L., Konowalchuk, J. D., Barreda, D. R. Modified Annexin V/Propidium Iodide apoptosis assay for accurate assessment of cell death. J Vis Exp. (50), e2597(2011).
  29. Hernandez, J. J., Beaty, D. E., Fruhwirth, L. L., Lopes Chaves, A. P., Riordan, N. H. Dodging COVID-19 infection: low expression and localization of ACE2 and TMPRSS2 in multiple donor-derived lines of human umbilical cord-derived mesenchymal stem cells. J Transl Med. 19 (1), 149(2021).
  30. Bourgeois, B. L., et al. Extracellular vesicle miR-206 improves chronic binge alcohol-mediated decreased myoblast differentiation in SIV-infected female macaques. Am J Physiol Cell Physiol. 327 (6), C1626-C1637 (2024).
  31. Kumar, P., Nagarajan, A., Uchil, P. D. Analysis of cell viability by the lactate dehydrogenase assay. Cold Spring Harbor. 2018 (6), (2018).
  32. Hsu, S., et al. Effects of everolimus on macrophage-derived foam cell behavior. Cardiovasc Revasc Med Including Mol Intervent. 15 (5), 269-277 (2014).

Reprints and Permissions

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

Request Permission

Explore More Articles

Biology

This article has been published

Video Coming Soon

JoVE Logo

Privacy

Terms of Use

Policies

Research

Education

ABOUT JoVE

Copyright © 2025 MyJoVE Corporation. All rights reserved