--- title: Ground Truth Estimation keywords: fastai sidebar: home_sidebar summary: "Implements functions for ground truth estimation from the annotations of multiple experts. Based on SimpleITK." description: "Implements functions for ground truth estimation from the annotations of multiple experts. Based on SimpleITK." nb_path: "nbs/09_gt.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %}

Helper Functions

Installing SimpleITK, which is not a dependency of deepflash2.

{% raw %}

import_sitk[source]

import_sitk()

{% endraw %} {% raw %}
{% endraw %}

Ground Truth Estimation

Simultaneous truth and performance level estimation (STAPLE)

The STAPLE algorithm considers a collection of segmentations and computes a probabilistic estimate of the true segmentation and a measure of the performance level represented by each segmentation.

Source: Warfield, Simon K., Kelly H. Zou, and William M. Wells. "Simultaneous truth and performance level estimation (STAPLE): an algorithm for the validation of image segmentation." IEEE transactions on medical imaging 23.7 (2004): 903-921

{% raw %}

staple[source]

staple(segmentations, foregroundValue=1, threshold=0.5)

STAPLE: Simultaneous Truth and Performance Level Estimation with simple ITK

{% endraw %} {% raw %}
{% endraw %}

Majority Voting

Use majority voting to obtain the reference segmentation. Note that this filter does not resolve ties. In case of ties it will assign the backgtound label (0) to the result.

{% raw %}

m_voting[source]

m_voting(segmentations, labelForUndecidedPixels=0)

Majority Voting from simple ITK Label Voting

{% endraw %} {% raw %}
{% endraw %}

GT Estimator

Class for ground truth estimation

{% raw %}

msk_show[source]

msk_show(ax, msk, title, cbar=None, ticks=None, **kwargs)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class GTEstimator[source]

GTEstimator(exp_dir='expert_segmentations', config=None, path=None, cmap='viridis', verbose=1) :: GetAttr

Class for ground truth estimation

{% endraw %} {% raw %}
{% endraw %} {% raw %}
exp_dir = Path('deepflash2/sample_data/expert_segmentations')
_get_expert_sample_masks(exp_dir)
files=['0004_mask.png', '0001_mask.png']
{% endraw %} {% raw %}
t = GTEstimator(exp_dir=exp_dir);
Found 5 unique segmentation mask(s) from 5 expert(s)
{% endraw %} {% raw %}
 
{% endraw %} {% raw %}
t.gt_estimation()
t.show_gt(files=files)
Starting ground truth estimation - STAPLE
100.00% [5/5 00:01<00:00]
{% endraw %} {% raw %}
t.gt_estimation(method='majority_voting', save_dir='mv_test')
t.show_gt(method='majority_voting', max_n=2)
Starting ground truth estimation - majority_voting
100.00% [5/5 00:00<00:00]
{% endraw %}