-
Notifications
You must be signed in to change notification settings - Fork 20
Segmenting with SuperSegger
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 (or train your own, look at section 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.
-
All your images need to be in monochromatic and in *.tif format
-
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 are after t are the time frames, after xy are for the different timelapse positions, and after c are the different channels respectively (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 different fields are :
- dirname : directory where the .tif images are.
- basename : name you want your images to be named eg. 'date-strain'.
- time prefix : characters before the number that indicates the time frame in your filenames.
- time suffix: characters after the number that indicates the time frame in your filenames.
- xy prefix: characters before the number that indicates the xy position in your filenames.
- xy suffix: characters before the number that indicates the xy position in your filenames.
- channelNames : this indicates the channels names in your filenames eg. {'BF','GFP'}.
If both the prefix and suffix are left blank the number 1 is set as default.
Examples:
- strain_0001t_BF.tif, strain_0001t_GFP.tif
- basename : name of your choice.
- time prefix : _
- time suffix : t_
- xy prefix :
- xy suffix :
- channelNames : BF,GFP
The images will be renamed to [basename]t001xy1c1.tif and [basename]t001xy1c2.tif
- 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.
The next step is to load the segmentations 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 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 it with the different constants (example shown below). In this picture the red are the fixed boundaries, the orange are the boundaries classified as true by the software. The blue are boundaries that were rejected.
The next step is to modify the segmentation parameters of 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)
-
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] find up to 5 foci in the first fluorescent channel, and 1 in the second)
-
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)
-
Neighbor flag (CONST.trackOpti.NEIGHBOR_FLAG) : to calculate number of neighbors per cell (default = false)
-
Minimum Cell age (CONST.trackOpti.MIN_CELL_AGE) : Minimum frames of cell age to be considered full cell cycle.
-
Time step (CONST.getLocusTracks.TimeStep): time step between frames. It is used for plotting in superSeggerViewer.
-
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.
-
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.
-
Clean all except alignment (cleanflag): It deletes any previous segmentation data files and re-does the segmentation starting from the aligned images. If false, it continues processing from the last successful step (default = false)
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];
The you can modify this to the channel order of 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'};
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 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.