Skip to content

Segmenting with SuperSegger

Stella edited this page Apr 29, 2018 · 31 revisions

Pre-segmentation

Our software automatically segments your images (identifies the regions in the image that correspond to cells), links the same cell from frame-to-frame, and calculates a variety of cellular characteristics. In order for the software to run, the user needs to rename the images to our file naming convention and choose the correct segmentation parameters from the set we provide (or train your own, more information about that at Creating your own constants functions).

All the pre-segmentation settings can be set by using our GUI (Graphical User Interface) or modifying processExp (dirname). If you are using processExp set all the settings above to the wished settings and then save the new file. To run the GUI type superSeggerGui in the console window. A window will pop up with the segmentation options.

Selecting the image folder

Click on the folder icon on the toolbar to select the folder where your .tif images are located. The path to the folder should appear under image directory.

Image Requirements

  • All your images need to be monochromatic and in *.tif format
  • Your images need to have been captured with magnified 60x (100nm/pix) or 100x (60nm/pix). This results to E. coli cells of about 5-8 pixels width. (More info about resizing your images under Issues & FAQ)
  • Your images need to be converted to our file naming convention (NIS Elements format)

The file naming convention we use [somebasename]t[number]xy[number]c[number].tif , where the numbers after 't' are the time frames after 'xy' are for the different timelapse positions, and after 'c' are the different channels (c1 are the phase images, c2 onwards are the fluorescence channels), eg MG1655_t001xy1c1.tif. The program can segment images for snapshots (i.e. if t is missing from the filename, [somebasename]xy[number]c[number].tif) or for one xy position (i.e. if xy is missing from the filename [somebasename]t[number]c[number].tif).

If your images do not have this name format you can use the GUI to convert the names. The way the name conversion works is the user indicates the characters before and after the time frame numbers, xy numbers and characters that indicate the channel. The program can then find the numbers and rename the images to our convention txyx*.tif. The different fields are:

  • dirname: the directory where the .tif images are.
  • basename: how you want your images to be named eg. 'date-strain'.
  • time prefix: characters in you current filename before the number that indicates the time frame.
  • time suffix: characters in you current filename after the number that indicates the time frame.
  • xy prefix: characters in you current filename before the number that indicates the xy positions.
  • xy suffix: characters in you current filename after the number that indicates the xy position.
  • channelNames: array of strings that indicate the different channels in your filenames eg. {'BF','GFP'}. The one that will be converted to c1 (phase image) should be first.

If you leave blank either the prefix or suffix the program can still rename the images. If both the prefix and suffix are left blank it renames everything using 1 as the default value.

**Example 1: strain_0001t_BF.tif, strain_0001t_GFP.tif **

  • basename : name of your choice.
  • time prefix : strain_
  • time suffix : t_
  • xy prefix :
  • xy suffix :
  • channelNames : BF,GFP

The images will be renamed to [basename]t001xy1c1.tif and [basename]t001xy1c2.tif

Example 2: strain-pos1-p-0001.tif, strain-pos1-g-0001.tif

  • basename : name of your choice.
  • time prefix : -
  • time suffix : .tif
  • xy prefix : pos
  • xy suffix: -
  • channelNames : -p-,-g-

After you type all the prefix/suffixes click 'Convert Image Names'. The images will be renamed to [basename]t0001xy1c1.tif and [basename]t0001xy1c2.tif.

Select Constants

The next step is to load the segmentation parameters that are suitable for your dataset. This is done from the list of constants or from loadConstants.

If you do not know which parameters to use you can use the following code to see which parameters may suit your cells better: tryDifferentConstants(dirname) or press the try Constants button on the GUI. It will let you crop an image of the final frame of your data set and it will segment the cropped image with the different constants (Example is shown below). In this picture, the red segments are the fixed boundaries, in orange are the boundaries classified as true by the software. The blue are boundaries that were rejected.

Modifying Constants parameters :

The segmentation parameters can be modified to better fit your needs. Some parameters you may want to modify are the following :

  • Parallel flag: runs the segmentation code in multiple cores, decreasing the processing duration.You must have the parallel processing toolbox to use this (default = false)

  • Neighbor flag (CONST.trackOpti.NEIGHBOR_FLAG) : to calculate number of neighbors per cell (default = false)

  • Fluorescence statistics (CONST.trackLoci.fluorFlag): Computes statistics of fluorescence image for each cell, the summed fluorescence intensity, the center of intensity and the second moments of the intensity distribution (default = false)

  • Verbose: Displays more information about the current step in the console.

  • Remove stray ( CONST.trackOpti.REMOVE_STRAY): Removes stray regions (that do not have a link in the previous frame) from the cell mask. Their descendants are also removed.

  • Clean all start - end (cleanflag): It deletes all segmentation steps from start step to end step and re-does those steps. If false, it continues processing from the last successful step (default = false)

  • Every [] frame (skip): Every [skip] number of images are segmented (If it is set to 1, every image is segmented). For a high frame rate, where the cells do not grow or move much, a higher skip value can decrease the processing time without affecting the segmentation quality. All fluorescence images are used, but the cell masks of the non-skipped frames are used.

  • Align Channel: Channel to be used for alignment. The default is 1 (Brightfield/phase).

  • Foci (CONST.trackLoci.numSpots): For superSegger to find fluorescent foci you need to set the number of maximum foci to be fit in each cell per fluorescence channel (default [0 0]). A value of [5 1] will find up to 5 foci in the first fluorescent channel (c2 in the naming convention), and up to 1 foci in the second (c3).

  • Time step (CONST.getLocusTracks.TimeStep): time step between frames. It is used for plotting in superSeggerViewer.

  • Minimum Cell age (CONST.trackOpti.MIN_CELL_AGE): Minimum frames of cell age to be considered full cell cycle.

  • Fluorescence Segmentation: Check this box if your images for segmentation are fluorescent instead of phase images. (Experimental version. Works but not fully optimized.).

  • Start step - End Step (StartEnd): You can set the step from which you would like to start and the step at which you would like to end the process. Some steps do require previous steps input to work so we recommend that you go through all the steps (start at 1 and end at 10). A use case for this is if you would like to only align your images and analyze them in a different way then you would choose as start: 1 and as end: 1. If you would like to re-run some steps on an already segmented data set you need to also check the 'Clean all start - end' box. The different steps are 1: alignment, 2: segmentation, 3: stripping small cells, 4: linking, 5: cell marker, 6: fluor, 7: foci, 8, cellA structure, 9: clist, 10: cell files.

Some other parameters that may be useful :

In loadConstants.m you may want to edit the alignment information for the different fluorescence channels. You can measure the misalignment between the different channels and then insert these values here :

CONST.imAlign.DAPI    = [-0.0354   -0.0000    1.5500   -0.3900];
CONST.imAlign.mCherry = [-0.0512   -0.0000   -1.1500    1.0000];
CONST.imAlign.GFP     = [ 0.0000    0.0000    0.0000    0.0000];

More information on obtaining these numbers can be found here

You can modify the channel order for your specific dataset. The images will be shifted according to the numbers above.

CONST.imAlign.out = {CONST.imAlign.GFP,    % c1 channel name
CONST.imAlign.GFP,  % c2 channel name
CONST.imAlign.GFP,  % c3 channel name
CONST.imAlign.GFP};    % c4 channel name

Another parameter that may be useful is the view.fluorColor. It controls the colors displayed in SuperSeggerViewer. Set it to the match the order of the channels you are using.

CONST.view.fluorColor = {'g','r','b','c','o','y'};

Start segmentation

You can start the segmentation by pressing Start SuperSegger in the GUI. If you are using processExp type in the Matlab command window processExp (‘path of the folder where your .tif images are located’). Depending on the size of your dataset, it can take from a few minutes to a day or two.

Clone this wiki locally