napari-imagegrains Processing Image Segmentation#

This widget allows you to perform image segmentation on your data. You can open it via Plugins -> ImageGrains -> ImageGrain Processing Widget.


Define folder locations#

When using the demo data provided, you start with a default situation. A model folder with two models is provided as well as an image folder with two images. Models and images are displayed in corresponding lists and can be selected upon mouse click. When selecting an image, it appears in the viewer. Under custom conditions, you start by indicating with Select model folder and Select image folder where your models and images are located. After that, you can select individual models and images to work with.


Explore image segmentation#

You can explore the image segmentation by chosing Run segmentation on selected image. The segmentation prediction (mask) will be displayed in the viewer on top of the selected image. Under Segmentation options you can check the Save prediction(s) checkbox in order to save the segmentation mask in the path you provide in Save prediction(s) to.

Be aware that a very large image requires some time to be segmented.


Manually process segmentation mask#

You can manually process the segmentation prediction by setting the label on the left side of the viewer to 0 and performing drawings. By clicking on Save manually processed mask you can save the processed mask in the path below.


Segmentation options#

Load initial prediction#

If you want to reload the initial prediction, check Load prediction(s), select another image from the image list and then select the initial image again. The initial prediction mask is reloaded.

Expected median diameter#

You can change the expected median diameter. Check Expected median diameter to activate a slider. Choose your expected median diameter (e.g. 50 pixels) and Run segmentation on selected image again to see the difference.

Use georeferencing (requires GDAL)#

In case that your image does contain georeferencing data, this data can be transferred to the prediction mask. Check Use georeferencing (requires GDAL) for that. This option requires the installation of the GDAL library in your environment. In addition, it is only available when an entire folder of images is segmented, it is not implemented for single image use.

Use GPU#

Check Use GPU to speed up image segmentation. This option requires a CUDA compatible GPU on your local machine.


Segment all relevant images in a folder#

By clicking Run segmentation on image folder you can segment all images that fullfill certain criteria in a folder. You can choose to either Segment .jpg or Segment .png or Segment .tif images at a time, depending on the image format you are using. In case that an image name contains a flag such as pred, flow, mask or composite, folder segmentation will not occur and you will obtain a warning instead. This is meant to prevent erroneous segmentation such as the further segmentation of segmentation masks.


Download a model from a repository#

You have the option to download additional segmentation models from Zenodo or Github. Check the Download model checkbox to activate the model download panel.

Manual and automate model download#

You can click the Zenodo button to be directed to the model repository on Zenodo. You can manually download individual models from here. Alternatively, you can copy the link of the model you are interested in an paste it in the Model URL box. After selecting a download directory you can click on Download model to save it on your computer.