Utilities đź› #

Here you will find a range of tools for image processing and analysis. See Usage section for instructions on launching the plugin.

Note

The utility selection menu is found at the bottom of the plugin window.

You may specify the results directory for saving; afterwards you can run each action on a folder or on the currently selected layer.

Default Paths for Saving Results#

Each utility saves results to a default directory under the user’s home directory. The default paths are as follows:

  • Artifact Removal: ~/cellseg3d/artifact_removed

  • Fragmentation: ~/cellseg3d/fragmented

  • Anisotropy Correction: ~/cellseg3d/anisotropy

  • Small Object Removal: ~/cellseg3d/small_removed

  • Semantic Label Conversion: ~/cellseg3d/semantic_labels

  • Instance Label Conversion: ~/cellseg3d/instance_labels

  • Thresholding: ~/cellseg3d/threshold

  • Statistics: ~/cellseg3d/stats

  • Threshold Grid Search: ~/cellseg3d/threshold_grid_search

Available actions#

1. Crop 3D volumes#

Please refer to Cropping✂️ for a guide on using the cropping utility.

2. Convert to instance labels#

This will convert semantic (binary) labels to instance labels (with a unique ID for each object). The available methods for this are:

  • Connected Components : simple method that will assign a unique ID to each connected component. Does not work well for touching objects (objects will often be fused).

  • Watershed : method based on topographic maps. Works well for clumped objects and anisotropic volumes depending on the quality of topography; clumed objects may be fused if this is not true.

  • Voronoi-Otsu : method based on Voronoi diagrams and Otsu thresholding. Works well for clumped objects but only for “round” objects.

3. Convert to semantic labels#

Transforms instance labels into 0/1 semantic labels, useful for training purposes.

4. Remove small objects#

Input a size threshold (in pixels) to eliminate objects below this size.

5. Resize anisotropic images#

Input your microscope’s resolution to remove anisotropy in images.

6. Threshold images#

Removes values beneath a certain threshold.

7. Fragment image#

Break down large images into smaller cubes, optimal for training.

8. Conditional Random Field (CRF)#

Note

This utility is only available if you have installed the pydensecrf package. You may install it by using the command pip install pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git#egg=master.

Refines semantic predictions by pairing them with the original image.
For a list of parameters, see the CRF API page.

9. Labels statistics#

Computes statistics for each object in the image.
Enter the name of the csv file to save the results, then select your layer or folder of labels to compute the statistics.

Note

Images that are not only integer labels will be ignored.

The available statistics are:

For each object :

  • Object volume (pixels)

  • \(X,Y,Z\) coordinates of the centroid

  • Sphericity

Global metrics :

  • Image size

  • Total image volume (pixels)

  • Total object (labeled) volume (pixels)

  • Filling ratio (fraction of the volume that is labeled)

  • The number of labeled objects

Hint

Check the notebooks folder for examples of plots using the statistics CSV file.

10. Clear large labels#

Clears labels that are larger than a given threshold.
This is useful for removing artifacts that are larger than the objects of interest.

11. Find the best threshold#

Finds the best threshold for separating objects from the background.
Requires a prediction from a model and GT labels as input.

Caution

If the input prediction is not from the plugin, it will be remapped to the 0-1 range.

The threshold is found by maximizing the Dice coefficient between the thresolded prediction and the binarized GT labels.
The value for the best threshold will be displayed, and the prediction will be thresholded and saved with this value.

Source code#