Package: napari-oclrfc
Note: This is a decommissioned napari pluginThis project is discontinued. You can still install and use it (last tested with napari 0.4.11) but this project is
no longer maintained and supported.Check outnapari-accelerated-pixel-and-object-classification (APOC)to learn more about this plugin's successor.napari-oclrfcpy-clEsperantomeetsscikit-learnA yet experimental OpenCL-based Random Forest Classifier for pixel and labeled object classification innapari.The processed example imagemaize_clsm.tifis licensed by David Legland underCC-BY 4.0 licenseFor using OpenCL-based Random Forest Classifiers for pixel classification in python, check outoclrfc.Thisnapariplugin was generated withCookiecutterusing with@napari'scookiecutter-napari-plugintemplate.InstallationYou can installnapari-oclrfcviapip. Note: you also needpyopencl.conda install pyopencl
pip install napari-oclrfcIn case of issues in napari, make sure these dependencies are installed properly:pip install pyclesperanto_prototype
pip install oclrfcUsageOpen an image in napari and add a labels layer. Annotate foreground and background with two different label identifiers. You can also add a third, e.g. a membrane-like region in between to improve segmentation quality.Click the menuPlugins > OpenCL Random Forest Classifiers > Train pixel classifier.
Consider changing thefeatureset. There are three options for selecting
small (about 1 pixel sized) objects,
medium (about 5 pixel sized) object and
large (about 25 pixel sized) objects.
Make sure the right image and annotation layers are selected and click onRun.The classifier was saved astemp.clto disc. You can later re-use it by clicking the menuPlugins > OpenCL Random Forest Classifiers > Predict pixel classifierOptional: Hide the annotation layer.Click the menuPlugins > OpenCL Random Forest Classifiers > Connected Component Labeling.
Make sure the right labels layer is selected. It is supposed to be the result layer from the pixel classification.
Select theobject class identifieryou used for annotating objects, that's the intensity you drew on objects in the annotation layer.
Hint: If you want to analyse touching neigbors afterwards, activate thefill gaps between labelscheckbox.
Click on theRunbutton.Optional: Hide the pixel classification result layer. Change the opacity of the connected component labels layer.Add a new labels layer and annotate different object classes by drawing lines through them.
In the following example objects with different size and shape were annotated in three classes:round, smallround, largeelongatedClick the menuPlugins > OpenCL Random Forest Classifiers > Train label classifier. Select the right layers for training.
The labels layer should be the result from connected components labeling.
The annotation layer should be the just annotated object classes layer.
Select the right features for training. Click on theRunbutton.
After training, the classifier will be stored to disc in the file you specified.
You can later re-use it by clicking the menuPlugins > OpenCL Random Forest Classifiers > Predict label classifierThis is an experimental napari plugin. Feedback is very welcome!ContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theBSD-3license,
"napari-oclrfc" is free and open source softwareIssuesIf you encounter any problems, pleaseopen a thread on image.scalong with a detailed description and tag@haesleinhuepf.