Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Quality Control

Segmenting and straightening images sometimes creates errors. This could be because a bright piece of dirt was accidentally segmented, because of worm’s body formed a loop in the image (omega turn), etc. This block is here to detect such images so they can be safely ignored during further analysis. At the same time, this block can also determine if the worm in a given picture is still in its egg or not. The quality control models (in practice, XGBoost models) can and should be retrained (see training part of the documentation : TO BE DONE). By default, the model uses both a mask and image as this improves error detection but a classifier could easily be trained to work only on masks or only on images.

Options

  • qc_masks: The column containing the masks you want to use for quality control (eg. ‘analysis/ch2_seg’ or ‘analysis/ch2_seg_str’)

  • qc_images: The column containing the images (fluorescence or not) you want to use for the quality control as well as the channel to use. Please note that they should have the same shape as the masks (eg. [‘raw’, [1]] or [‘analysis/ch2_raw_str’, null])

  • qc_model_path: The path to your quality control model (eg. '/mnt/towbin.data/shared/spsalmon/towbinlab_classification_database/models/10x_body_qc/qc_xgb_model.pkl)

  • qc_import_eggs_from: Sometimes it’s hard to recognize eggs using only some channels / organs. To not make this analysis redundent, you can import the egg classification from a previously run quality control block. (eg. ‘ch2_seg_str_qc’). Defaults to null

Example

Let’s say that in previous blocks we segmented the first and second channel of our images. This would create two new columns in the experiment’s filemap :

  • analysis/ch1_seg

  • analysis/ch2_seg

We then straightened each mask and the corresponding channel in the raw images, resulting in 4 new columns in the filemap :

  • analysis/ch1_seg_str

  • analysis/ch1_raw_str

  • analysis/ch2_seg_str

  • analysis/ch2_raw_str

If we want to run a quality control for those two channels, we could use the following configuration :

qc_masks: [ 'analysis_towbintools_paper/ch2_seg_str', 'analysis_towbintools_paper/ch1_seg_str' ]
qc_images: [ [ 'analysis_towbintools_paper/ch2_raw_str', null ], [ 'analysis_towbintools_paper/ch1_raw_str', null ] ]
qc_model_path: [ "/mnt/towbin.data/shared/spsalmon/towbinlab_classification_database/models/10x_body_qc/qc_xgb_model.pkl", "/mnt/towbin.data/shared/spsalmon/towbinlab_classification_database/models/10x_pharynx_qc/qc_xgb_model.pkl" ]
qc_import_eggs_from: [ null, "ch2_seg_str_qc" ]

In this case, for the QC of channel 1, we are importing the egg/not egg classification from the QC of channel 2.

This would create two new columns in the filemap :

  • analysis/ch1_seg_str_qc

  • analysis/ch2_seg_str_qc