Package: napari-buds
napari-budsRandom-forest automated bud annotationThisnapariplugin was generated withCookiecutterusing@napari'scookiecutter-napari-plugintemplate.Installationmake sure you already have installed napari.Next, You can installnapari-budsviapip:pip install napari-budsTo install latest development version :pip install git+https://github.com/SanderSMFISH/napari-buds.gitContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.DocumentationNapari-Buds is a random forest based mother-bud annotation plugin for Napari devevoped by the TutucciLab (https://www.tutuccilab.com/) of the systems biology group at the Vrije Universiteit van Amsterdam. Mother-bud annotation requires single or multichannel 2D images of budding yeast and a fluorescent marker that localizes to the bud. In the example dataset provided smFISH DNA-probes were used as localized bud marker.The GUI layout for random forest based classification was inspired by ImageJ 'plugin Weka Segmentation' [1].Before installation make sure you have a working version of napari installed (pip install "napari[all]").Napari-Buds is a random forest based mother-bud annotation plugin for Napari developed by the TutucciLab (https://www.tutuccilab.com/) of the systems biology group at the Vrije Universiteit van Amsterdam. Mother-bud annotation requires single or multichannel 2D images of budding yeast and a fluorescent marker that localizes to the bud. In the example dataset provided smFISH DNA-probes were used as localized bud marker.The GUI layout for random forest based classification was inspired by ImageJ 'plugin Weka Segmentation' [1].Please follow the workflow described underneath to perform mother-bud annotation:Open images in napari and create empty label layer.
For multichannel images each channel should be provided seperately to napari.
An example (jupyter) notebook (Open Test Images Napari.ipynb) for loading test data in napari is provided in the notebooks folder.
Example dataset can be downloaded fromhttps://zenodo.org/record/7004556#.YwM1_HZBztU.If multichannel images are unaligned the  translate widget under Plugins>napari-buds>Translate can be used.
Select which layer should be translated to align to the layers in widget menu. Then use the aswd keys to translate (move) the selected layer.
To register changes and update coordinates of the translated image in napari press t.Random forest classificationTo open the mother-bud annotation plugin go to Plugins>napari-buds>bud annotation.To train a random forest classifier, in the created label layer draw examples of cells, buds and background (see tutorial gif below).
In the Define Label segment of the widget you define which label value (class #label_value) corresponds to cells, buds and background.
Currently, cells and backgrounds and budshave to be defined in the Define Label segmentif you want to be able to segment the classification as well.
In the segmentLayers to extract Features fromwe can select which layers will be used in training the random forest classifier.
Next pressTrain classifier. After training is completed a result layer is added to layer list.
Inspect the results carefully to asses classifier performance. The trained classifier can be saved using thesave classifierbutton.
Previously trained classifier can be loaded by pressingLoad classifier. Loaded classifier can applied to new images by pressingClassify, resulting again in a results layer.
It is possible to change the random forest parameters withthe Set random forest parametersbutton and changing the values in the pop up menu.
PressRunto register changed settings. For an example of the parameters used see:https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.htmlandhttps://scikit-image.org/docs/stable/auto_examples/segmentation/plot_trainable_segmentation.html.Next, we want to perfom watershed segmentation using the result layer. However, for watershed segmentation seeds (also called markers) are required
(for an explanation of watershed segmenation see:https://en.wikipedia.org/wiki/Watershed_(image_processing)).
To define the seeds we can either simply threshold on one of the supplied image layers or we can use distance tranform (https://scikit-image.org/docs/stable/auto_examples/segmentation/plot_watershed.html#sphx-glr-autoexamples-segmentation-plot-watershed-py).The resulting seeds layer can be adjusted manually by editing in napari.
A good seeds layers correspond to each cell having a single seed (buds are not single cells). To perform watershed segmentation press theSegmentbutton.Carefully inspect the resulting cell mask and bud layer. Correct the mistakes in both layers.
Bud label values should correspond to the label value of the cell mask of mother cell. To verify mother bud relations were drawn correctly
pressDraw Mother-Bud relations. If Mother-Bud relations are correct, you can save both label layers. Mother and buds simply share the same label number.
Thus, either the mother or bud layer can be manually corrected for mistakes. Corrections can be checked by clickingDraw Mother-Bud relationsagain.
mother and buds layer can be saved manually in napari. When using Jupyter notebook mother and bud layers can be saved as shown in Open Test Images Napari.ipynb.An example notebook for dataextraction of the created cell and bud masks can be found in the example notebooks folder (Extract_Mother_Buds_relations_from_Masks_and_intergrate_FQ_spot_data.ipynb).This notebooks relates RNA spots (smFISH data found on zenodo) to the mother or bud compartment.See video for clarification:Similar Napari plugins1-napari-accelerated-pixel-and-object-classification (APOC) by Robert Haase.2-napari-feature-classifier.LicenseDistributed under the terms of theBSD-3license,
"napari-buds" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.Known IssuesIf window geometry of the window is unable to be set, this might lead to issues in the display of the widget. For example, part of the widget might fall of the screen.
In these cases, it might help to adjust in your display setting the display scaling to a lower setting.ReferencesArganda-Carreras, I., Kaynig, V., Rueden, C., Eliceiri, K. W., Schindelin, J., Cardona, A., & Sebastian Seung, H. (2017). Trainable Weka Segmentation: a machine learning tool for microscopy pixel classification. Bioinformatics, 33(15), 2424–2426. doi:10.1093/bioinformatics/btx180