ZEISS Microscopy Knowledge Base
Help
ZEISS Microscopy Knowledge Base

Using StarDist

This article guides you through the implementation of StarDist segmentation.

Introduction

StarDist is a deep learning-based method for 2D and 3D nucleus detection, developed & published by Martin Weigert and Uwe Schmidt: github.com/stardist/. StarDist uses a cell detection method that predicts a shape representation with star-convex polygons that is well-suited to approximate the typically roundish shapes of cell nuclei in microscopy images.The 3D shape of a single object (cell nucleus) is described using a star-convex polyhedron instead of polygons.

StarDist is reported to run well in multiple open source environments such as Fiji/ImageJ, Qupath or Python (Using Python editor like Jupyter Notebook, PyCham and Spider), but what are the benefits of integrating StarDist directly inside of your arivis Vision4D imaging software? In this document, we will highlight the advantages of integrating open source analysis tools such as StarDist directly in Vision4D.

Preliminary Remarks

Vision4D is able to run deep learning applications such as StarDist using external and arivis-independent Python libraries and tools produced by third parties.

These tools must be installed by the user under his or her own responsibility, strictly following the instructions in this document. arivis has tested the setup protocol on several computers, however, due to the different and unpredictable hardware and software configurations of any given computer system, the results may vary on a case-by-case basis. Therefore, arivis declines any responsibility concerning the correct tools,  installation, and set up on the individual user’s workstation. arivis cannot be made responsible for any malfunctioning or failure of the deep learning environment setup. arivis does not guarantee technical support on the setup task or on any deep learning application. Furthermore, arivis also declines any responsibility regarding the validity of the scientific results gathered from the deep learning application.

Why use StarDist within Vision4D?

arivis Vision4D (V4D) is a modular software for working with multi-channel 2D, 3D, and 4D images of almost unlimited size, independent of available RAM. Many imaging systems, such as high-speed confocal, light sheet / SPIM, and 2-photon microscope systems can produce vast amounts of multi-channel data, which Vision4D handles without constraints.

V4D allows the user to execute complex analysis tasks in automatic or batch mode. This includes sophisticated pre-processing algorithms, multiple segmentation approaches (including machine learning segmentation tools), and powerful data handling. Dataset from Mega- to Terabytes in size can be quantified by Vision4D with a single pipeline on virtually any computer that is capable of holding the data (see system requirements).

StarDist represents an advanced method to detect roundish objects such as cells and nuclei, especially in crowded fields where the objects are overlapping, but it is limited to these cases. The new frontiers of image analysis in life science need the capability to analyze the complex iterations between biological structures. Vision4D has the tools to satisfy these requirements. StarDist can be integrated into the V4D analysis workflow and directly contribute to better detect its target structures.

StarDist can already be currently executed as a python script but, in the near future, it will be available as a V4D pipeline operator, making its usage even more flexible and powerful.

Loading the script

A startup package including the python script, the technical instructions and the test image is available on request. Contact your arivis local area sales manager to get more information about how to get the python script mentioned here or use the contact form on our website

In the Script Editor, the script can be opened by dragging. the .py file into an open window, of by going to File > Open... and navigating to the script file.

Once loaded some parameters will need to be changed for your specific images. 

# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ USER SETTINGS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

# -----------------------------------------------------------------------------

# Stardist 2D - Script

# INPUT_CHANNEL channel with the target objects

# is only used to read/write the voxels

# ---> imageset.get_channeldata / imageset.set_channeldata# -----------------------------------------------------------------------------

INPUT_CHANNEL = 1 # <---- Count start from 0 (Ch#1 == 0)

# name of the new channel (skeleton storage)

OUTPUT_CH_NAME = "Stardist_" # Net_Skel_

#

#MODEL3D_PATH = "D:/Arivis_Dataset/Carlo Stardist/2021-05-10/3D/2021-04-22/models"

MODEL2D_PATH = "D:/Arivis_Dataset/Carlo Stardist/2021-05-10/2D/2021-05-03/models"

MODEL_NAME = "stardist"

# PARAMETERS YOU CAN CHANGE?

CURRENT_TIME_POINT = True

FIRST_PLANE = -1 # -1 == BOTTOM

LAST_PLANE = -1 # -1 TOP

#

# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ END USER SETTINGS @@@@@@@@@@@@@@@@@@@@@@@@@@@@

Of specific importance are:

  • Input Channel number (remember the first channel is channel "0"). This is to specify which channel to do the segmentation on
  • Model Path and name. This will depend on your installation and the model you are using. 
  • Input range.
  • CURRENT_TIME_POINT, if true only the current time point is analyzed, if false the entire time series.
  • FIRST_PLANE, the first plane in the stack to be used for segmentation
  • LAST_PLANE, the last plane in the stack to be used for segmentation
  • Note that is both the first and last plane parameters are set to "-1" the script will use the full stack.

Once the parameters have been set the script can be saved and run.

Download Full "How to run StarDist within arivis Vision4D" PDF

Impressum
Carl-Zeiss-Strasse 22
73447 Oberkochen
Germany
Legal