monailabel.scribbles.transforms module

class monailabel.scribbles.transforms.AddBackgroundScribblesFromROId(scribbles, roi_key='roi', meta_key_postfix='meta_dict', scribbles_bg_label=2, scribbles_fg_label=3)[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

class monailabel.scribbles.transforms.ApplyCRFOptimisationd(unary, pairwise, meta_key_postfix='meta_dict', post_proc_label='pred', iterations=5, bilateral_weight=5.0, gaussian_weight=3.0, bilateral_spatial_sigma=1.0, bilateral_color_sigma=5.0, gaussian_spatial_sigma=0.5, update_factor=5.0, compatibility_matrix=None, device='cpu')[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

Generic MONAI CRF optimisation transform.

This can be used in conjuction with any Make*Unaryd transform (e.g. MakeISegUnaryd from above for implementing ISeg unary term). It optimises a typical energy function for interactive segmentation methods using MONAI’s CRF layer, e.g. Equation 5 from https://arxiv.org/pdf/1710.04043.pdf.

Usage Example:

Compose(
    [
        # unary term maker
        MakeISegUnaryd(
            image="image",
            logits="logits",
            scribbles="label",
            unary="unary",
            scribbles_bg_label=2,
            scribbles_fg_label=3,
        ),
        # optimiser
        ApplyCRFOptimisationd(unary="unary", pairwise="image", post_proc_label="pred"),
    ]
)
class monailabel.scribbles.transforms.ApplyGraphCutOptimisationd(unary, pairwise, meta_key_postfix='meta_dict', post_proc_label='pred', lamda=8.0, sigma=0.1)[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

Generic GraphCut optimisation transform.

This can be used in conjuction with any Make*Unaryd transform (e.g. MakeISegUnaryd from above for implementing ISeg unary term). It optimises a typical energy function for interactive segmentation methods using numpymaxflow’s GraphCut method, e.g. Equation 5 from https://arxiv.org/pdf/1710.04043.pdf.

Usage Example:

Compose(
    [
        # unary term maker
        MakeISegUnaryd(
            image="image",
            logits="logits",
            scribbles="label",
            unary="unary",
            scribbles_bg_label=2,
            scribbles_fg_label=3,
        ),
        # optimiser
        ApplyGraphCutOptimisationd(
            unary="unary",
            pairwise="image",
            post_proc_label="pred",
            lamda=10.0,
            sigma=15.0,
        ),
    ]
)
class monailabel.scribbles.transforms.InteractiveSegmentationTransform(meta_key_postfix='meta_dict')[source]

Bases: monai.transforms.transform.Transform

class monailabel.scribbles.transforms.MakeISegUnaryd(image, logits, scribbles, meta_key_postfix='meta_dict', unary='unary', scribbles_bg_label=2, scribbles_fg_label=3)[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

Implements forming ISeg unary term from the following paper:

Wang, Guotai, et al. “Interactive medical image segmentation using deep learning with image-specific fine tuning.” IEEE transactions on medical imaging 37.7 (2018): 1562-1573. (preprint: https://arxiv.org/pdf/1710.04043.pdf)

ISeg unary term is constructed using Equation 7 on page 4 of the above mentioned paper. This unary term along with a pairwise term (e.g. input image volume) form Equation 5 in the paper, which defines an energy to be minimised. Equation 5 can be optimised using an appropriate optimisation method (e.g. CRF, GraphCut etc), which is implemented here as an additional transform.

Usage Example:

Compose(
    [
        # unary term maker
        MakeISegUnaryd(
            image="image",
            logits="logits",
            scribbles="label",
            unary="unary",
            scribbles_bg_label=2,
            scribbles_fg_label=3,
        ),
        # optimiser
        ApplyCRFOptimisationd(unary="unary", pairwise="image", post_proc_label="pred"),
    ]
)
class monailabel.scribbles.transforms.MakeLikelihoodFromScribblesGMMd(image, scribbles, meta_key_postfix='meta_dict', post_proc_label='prob', scribbles_bg_label=2, scribbles_fg_label=3, num_mixtures=20, normalise=False)[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

class monailabel.scribbles.transforms.MakeLikelihoodFromScribblesHistogramd(image, scribbles, meta_key_postfix='meta_dict', post_proc_label='prob', scribbles_bg_label=2, scribbles_fg_label=3, num_bins=64, normalise=True)[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform

class monailabel.scribbles.transforms.SoftenProbSoftmax(logits='logits', meta_key_postfix='meta_dict', prob='prob')[source]

Bases: monailabel.scribbles.transforms.InteractiveSegmentationTransform