- Opening DetecDiv
- Setting up a new project
- Defining and using regions of interests (ROIs)
- Creating and setting up a classifier
- Editing a classifier
- Classifying new data
- Example #1 : semantic segmentation workflow
- Division counting and replicative lifespan analyses
Type in Matlab workspace:
>> detecdiv
DetecDiv main window:
File --> New Project --> Choose filename/location
File --> Save Project
Please note that a corresponding variable associated with the project is listed in the workspace:
This variable can be accessed at any time to gather information, include as an argument in your own scripts, or use additional command-line functions of DetecDiv.
Click on the project name in the tree window:
Select --> Add data...
The addData GUI can parse files and folders with different formats according to specific rules, see below. Choose a directory that contains either:
- a list of files corresponding to one microscope field-of-view that contains all channels, timepoints and stacks data. Filters may used to parse channels and stacks from the names of the files.
- a list of multi-tif files (each multi-tif file will considered as one field of view and must contain relevant information to parse the different channels, time points etc).
- a PhyloCell project .mat file (and dependent folders).
Example of file list parsing :
Example of multi-tiff files parsing :
Click --> Add selected positions to project Click --> Close
Information about the position added is available in the tree window by expanding the project node:
WARNING : Save the project at this point. If not, any modification would be lost upon closing the project. For this, click File --> Save selected project
Select a project in the tree window.
Right-click on a position node and click : --> Open position... This will load a window with raw images of all available channels as a series of grayscale images. You can scroll through time by using left and right keyboard arrows. Disable all channels but channel #1 by unchecking the corresponding boxes in the 'Channel' menu.
To define an ROI, zoom and pan on the desired area by selecting Matlab tools on the top-right corner of the image. With the pan or zoom tool still selected, right click on the image to refine the region of interest by either:
- manually adjusting the window position: --> switch to pan mode
- adjusting the dimensions of the ROI: --> Adjust current zoom... ; In this case, set up the numbers that correspond to : [ x y width height]
Once the ROI is OK, right-click : --> Add current ROI
Then click: --> Reset zoom ; The ROI is now represented in red on the raw image:
Deselect the zoom or pan MATLAB tools : you can now select the ROI of interest (it appears in yellow) and further adjust ROI parameters:
Repeat these operations to create as many ROIs as necessary. Close the the Figure window when done.
First, manually set an ROI as described above.
Select the ROI, right-click --> Select the ROI as reference pattern; The contours of the ROI become bold.
(Optional) Specify a "cropping area" that will discard any detect ROI outside of the cropping area: For this, click --> Set/show cropping area in the 'Display Options' menu and draw a polygon correspinding to the desired area:
Right-click on the cropping area to hide or delete it. Close the figure window.
In detecdiv, select the project and click --> identify ROIs based on image pattern; this launches the ROI identification GUI. The GUI displays an image of the selected pattern:
You can change the pattern by changing the frame used to generate it: --> Set frame edit field (default frame is the first frame). Select all the positions to be processed with this selected pattern. A cropping area will be used if one has been defined above.
Choose --> Overwrites existing ROIs (deletes the manually defined ROIs, but keeps the detection pattern) or --> Keep existing ROIs (preserves the existing ROIs)
Click --> Identify and create ROIs based on pattern; Once the detection is complete, the number of ROIs detected is updated in the table for each position Close the ROI identifer GUI.
You can now see the avaiable ROIs as subnodes of the position nodes:
You can also look at the spatial location of these ROIs by opening the position window (right-click on a selected position, as described previously):
WARNING: Save the project at this time.
Once defined, ROIs data can be extracted by creating individual .mat files that contains (X,Y,Channel,Time) information.
Select a relevant project and position by navigating the tree window.
Click: --> Extract ROIs data from raw data
Select parameters:
-Array of frames
-Array of positions to be processed
-Max number of frames loaded in memory (this is is to prevent loading all the raw images at once during this process).
-Channel-specific relative frame interval: If channel 1 is snapped every 5min and channel 2 is snapped every 10 minutes, then type 1 2. (The data parsing program attempts to guess this paramter by counting the respective number of files for each channel).
Confirm your choice.
This process takes a very long time. It uses parallel computing to distribute computing tasks on different workers. Information in the workspace is indicated to show the progression of the process. The project is automatically saved at the end of the process.
Once extracted, ROIs data can be viewed by left-clicking on subnodes of the position nodes in the tree window. A figure window will appear, allowing to select the channels to be displayed. Use keyboard arrow keys to scroll trhough time.
Select the project of interest in the tree window.
Click --> add Classsifier.
Select "New Classifier". Enter the name of the classifier and click --> Proceed. WARNING : save project at this time.
If a classifier is loaded in the workspace (either a project-based or project-independent classifier), you can transfer it to your own project. Select the project of interest in the tree window.
Click --> add Classsifier.
Select "Duplicate existing classifier in the workspace". In the dropdown list, select the desired classifier.
Check which aspect of the classifier should be transferred:
-
training parameters (hyperparameters used by the training procedure)
-
the file that contains the trained classifier (which can be used right away without further training)
-
formatted groundtruth images that can be used to train/re-train the classifier
-
the trainingset (i.e. a list of ROIs that have been manually annotated and are used to generate the groundtruth image dataset). In this case, please specfiy the array of ROIs to be transferred.
Enter the name of the new classifier and click --> Proceed. WARNING : save project at this time.
Once a classifier is created, dependent ROIs (if any) are listed as subnodes of the classifier node. They can be open by left-clicking the corresponding nodes:
To edit a classifier: Right-click on a classifier --> Open classifier.
The classifier GUI has 3 tabs to allow parameters setup:
- classification parameters; Please entrer information as requested.
First select the type of classifier in the drop down list: Image classification, Image sequence classification (LSTM+CNN), Pixel classification (semantic segmentation), Timeseries classification etc.
Then , select the "output type" if available : sequence-to-sequence means that each frame will be classified. sequence-to-one means that the sequnece wil classified as a whole. Select the name of the channel name to be used for training. This channel name can be set using the drop down menu that lists all possible values taken from the ROIs attached to this classification models.
Enter the names of the classes to be used by the classifier.
In case of pixel classification (semantic segmentation), you can specify various post-processing parameters, or a custom function handle;
- Training procedure parameters; Enter parameter values in the table.
Most of the parameters are in common with all classification models. Parameters for image sequence classification include:
Method : network training methode - adam or sgdm.
Network : name f the network used as a base for classification - googlenet (inception), resnet50 or resnet18
MiniBatchSize : size of the minibatch used fro a single training step - from 1 to 128 depending on the size of the trainingset and the memory available on the computer.
MaxEpochs : number of cycles used to performs network optimization.
InitialLearnRate : rate associated with parameter modification in the network layers.
Shuffle : shuffle of data set between training and validation set - every-epoch is the only option.
Split : fraction of the data set used for training versus validation
translateAugementation : range of the translation perofrmed on images in the trainingset to augment the dataset (in pixels)
rotateAugmentation : range of the rotation performed on images in the trainingset to augment the dataset (in degrees)
regularization : L2-regularization parameter
execution environment : GPU, CPU or parallel (to use multi cpu computing).
- ROIs used as trainingset or testset.
The table displays the list of ROIs imported to be used either as training set (for training the classifier) or as testset (to benchmark the classifier).
Specific buttons on this tab:
*Select/Delect ROIs: Select/Unselect the ROIs to be used as training set (network training) or, alternatively, as a test set (validation)
*Import ROIs: Additional ROIs can be imported from other ROIs available in the workspace.
*Annotate selected ROI : launches a figure window to perofmr manual annotation of the training/test sets. Shortcut keys indicated in the "Classes" menu can be used to assign one among all available classes for each frame.
Menu functions :
File Menu --> Save classifier parameters. This is required each time parameters are changed on any of the 3 tabs.
CLassifier Menu --> thie menu contains all the functions that are used to train and validate the classifier:
- Format trainingset for training : this function exports ROIs data as images to folders. These images will be then used by the training procedure
- Train classifier : launches the training procedure
- Validateclassifier : classify all the ROI data in the classifier GUI using the trained network (if any).
- Display statistics: performs the validation of the classifier by comparing predictions and groundtruth for the testset only (i.e. input training data are not considered to compute statistics)
- Load classifier : loads the classifier in the workspace / memory, so that it can be used to perform various classification task
- Check status : this can be used to check the status (Red/Green lamps) of the classifier
Click --> Classify data after seelcting a project in the tree window.
In the classify data GUI:
- Select a classifier
- Select positions and ROIs to be processed in the table window. You can also edit the channel in the ROIs to be used as input of the classifier. By default, the channel value is identical to that used for training the classifier. Classification can take a very long time depending on the size of the dataset. Classification results are automatically saved.
Once finished, classified data can be monitored by left-clicking ROIs in Project->Position subnodes:
- Create a new DetecDiv project, import data and extract ROIs as described above
(MORE SOON)
This programs provides a GUI for division counting and RLS analyses. IMPORTANT: Please note that all the data must be classfied beforehand, as this GUI is only processing classified datasets.
- Load an independent classifier or a project that contains a division classifier in detecdiv:
- Check that the classifier was correctly set up (i.e., 6 classes: unbud, small, large, dead, empty, clog) . It must have been trained according to the principles defined above, and data MUST be classfied beforehand.
Default parameter values are as follows:
- Type in Matlab workspace:
>> detector
This will launch a new window as follows:
- Set as many "data groups" as necessary. For instance, assign one group per mutant strain. Each data group will result in a separate curve on a plot. For each group, set the parameter values. Importantly, choose the appropriate classifier name in the dropdown list and select the data (individual ROIs, all ROIs in positions, all ROIs in projects, etc.):
Select "bud" as classiftype.
Press 'save selected group' each time the selection of parameters or data has changed. Please note that groups can be saved to and loaded from the disk as .mat file (use the File... menu).
- Click the 'Division counting' tab, to extract division information based on classifier results. Check the data group to be plotted and assign plotting parameters values. "Export Plot" will save the figure file as .pdf on the disk in the Matlab current folder (using "Filename" as a file name). The CSV export mode saves the list of divisions as comma-separated values. The workspace export mode assigns a variable (using the "Filename" name) in the matlab workspace for further processing (scripts, etc.).
- Then, click 'Plot/Export':
- Click on the "RLS Analysis" tab to display RLS data, similarly as with the division counting tab. In the case below, the "groundtruth versus prediction" was selected.