Skip to content

Stardist

guijacquemet edited this page Dec 8, 2020 · 40 revisions

Segment Nuclei using StarDist:

StarDist is a deep-learning method that can be used to segment cell nuclei in 2D (XY) single images or in stacks (XYT). This page contains information to help you train StarDist networks in google Colab using your own images.

Important disclaimer

The Myers laboratory-created StarDist, and you can access the original papers here:

Please also cite these original papers when using StarDist with our notebook.

StarDist resources

Data required to train StarDist

To train a StarDist network you need matching images of nuclei and of corresponding masks (see example bellow).

Sample preparation and image acquisition

Nuclei can be stained using your method of choice (for instance, using DAPI for fixed samples or SIR-DNA for live samples), and images can be acquired on a wide variety of instruments. For instance, for the training dataset provided with our notebook, cells were incubated for 2h with 0.5 µM SiR-DNA (SiR-Hoechst) before being imaged live using a spinning-disk confocal microscope. The spinning-disk confocal microscope used was a Marianas spinning disk imaging system with a Yokogawa CSU-W1 scanning unit on an inverted Zeiss Axio Observer Z1 microscope (Intelligent Imaging Innovations, Inc.) equipped with a 20× (NA 0.8) air, Plan Apochromat objective (Zeiss).

Generating masks for StarDist 2D

Masks can be generated manually in Fiji by following the instructions below:

  • Install Fiji
  • Install the LOCI plugin
  • Open your Nuclei image in Fiji
  • Draw the outlines of the nuclei, one by one, using the freehands selection tool
  • Add each outline to the ROI manager (key shortcut "t")
  • Once all the nuclei have been outlined, use the LOCI plugin to create an ROI map (Plugins-> LOCI-> ROI map)
  • Save the mask image
  • Rename the mask image so that its name matches the corresponding nuclei image

Training StarDist in Google Colab

To train StarDist (2D or 3D) in Google Colab:

Network Link to example training and test dataset Direct link to notebook in Colab
StarDist (2D) here Open In Colab
StarDist (3D) from Stardist github Open In Colab

or:

Once a StarDist model has been trained, it can be applied to detect nuclei (or other roundish objects) from microscopy images. One possible biological application is to identify nuclei over time from live-cell imaging data (cell migration experiments). Once detected, the Nuclei can be tracked. Bellow is a short protocol illustrating how StarDist and Trackmate can be connected to track and quantify cell migration automatically.

Trackmate is user-friendly and powerful software to perform tracking experiments. Trackmate is developed by Jean-Yves Tinevez and colleagues, and you can access the original paper here:

Please also cite this original paper when combining StarDist and Trackmate.

Step-by-step protocol

You can download a full step-by-step protocol here or check our paper here

Step 1: train a StarDist model using our ZeroCostDL4Mic StarDist 2D notebook

  • For detailed instructions, see above
  • Make sure to evaluate your StarDist model using our QC section.

Step 2: Use ZeroCostDL4Mic StarDist 2D notebook to generate tracking files

  • Save all the video you want to analyze as .tif file in a folder and upload them to google drive
  • Initiate the ZeroCostDL4Mic StarDist 2D notebook (Section 1 and 2)
  • Go to section 6 of the ZeroCostDL4Mic StarDist 2D notebook
  • Choose "stacks" as Data Types
  • Enable the "Tracking file" option
  • Make sure to load the correct StarDist model you want to use to make predictions
  • Download the Tracking files

The "tracking files" are images where the centre of each detected nuclei is indicated as a spot. This can then easily be detected in Trackmate.

Step 3: Perform the tracking using Trackmate

Analysis of one file at the time:

  • Open the previously generated tracking files in Fiji
  • Open Trackmate (Plugin -> Tracking -> Trackmate)
  • In Trackmate, choose the Downsample LoG detector
  • Use the following parameters: Estimated blob diameter (1), Threshold (1), (downsampling factor (1). Use the preview to ensure that the detection is correct
  • Choose the LAP tracker
  • Choose an appropriate frame linking distance. Consider enabling Track segment splitting (cells can divide) and disable Track segment merging.
  • For more information on how to use Trackmate, consider looking at this excellent tutorial.

Batch analyses

We created a Fiji macro to batch analyze a folder containing multiple "tracking files" generated by our StarDist notebook. You can download it here.

  • Drag and drop the file on Fiji
  • Click on "run."
  • Follow the instructions

Step 4: Analysis of cell tracks

Once tracked using Trackmate, results can be further processed using Motility lab. In particular, our automated tracking script will save files that are optimized to be analyzed with this online tool. If you are using batch processing, you can use our R script to compile your results in a two .csv files. You can download the R script here here.