Note

This page was generated from 1_auxseg_livewire.ipynb. Interactive online version: Colab badge. Some tutorial content may look better in light mode.

1.Auxiliary segmentation (AuxSeg): an interactive tool for ROI segmentation#

AuxSeg is designed to select the regions of interest (e.g., an entire tissue or a tumor core) in any arbitrary geometrical shape based on simple mouse clicks (instead of a pure-manual boundary drawing).

AuxSeg is implemented with three modes:

(1) Livewire mode (a simplified magic wand tool)

This allows the user to compute a ‘best’ path, with a minimum color gradient cost (see technicals), from a seed point to the next seed point. When these seed points land on the boundaries of a tissue in sequence, the livewire will snap on the tissue boundaries in the image.

Related mouse and keyboard operation:

  1. Plot a seed point: Left mouse button single click;

  2. Draw a line: Mouse movement. In the livewire mode, the predicted path will be pre-showed on the image.

(2) Straight-line mode

This allows the user to draw the straight line between two seed points, when the livewire does not give the accurate prediction along some fuzzy edges, or the user just wants a straight regular border.

Related mouse and keyboard operation:

  1. Switch to straight-line mode: Keyboard ‘s’.

(3) Withdraw mode

This allows the user to cancel the last operation.

Related mouse and keyboard operation:

  1. Withdraw: Keyboard ‘z’.

Demo video#

[12]:
import io
import base64
from IPython.display import HTML
video_path = "./screenshot/auxseg_livewire.mp4"
video = io.open(video_path, 'r+b').read()
encoded = base64.b64encode(video)
HTML(
    data=
    '''
    <video width="350" height="460" controls>
    <source src="data:video/mp4;base64,{0}" type="video/mp4" />
    </video>
    '''.format(encoded.decode('ascii'))
)
[12]: