3 ¨` ã @ st d dl Zd dlmZ d dljZd dlmZ dddgfddZ dddgd d dgdd dgddddfddZ dddZdS )é N)Úmeasure)Úbinary_fill_holesé é é c C sP g }xF|D ]>}t | |k}tj|d}|tjdd |D }|j| q W |S )Ngé?c S s g | ]}t |qS © )Úlen)Ú.0Úcr r úT/tf/Dropbox (Partners HealthCare)/ubuntu/docker/repos/DeepStrain/utils/visualizer.pyú <listcomp> s zContours.<locals>.<listcomp>)r r Z find_contoursÚnpÚargmaxÚappend)ÚmaskÚ tissue_labelsÚcontoursÚiZmask_r r r r ÚContours s r ÚlimeÚmagentaÚredÚRVÚLVMÚLVg¹?Fc C sl t ||d} xJt| D ]>\} }| j|d d df |d d df |||| || d qW |rh| jdd d S )N)r r r )ÚalphaÚ linewidthÚcolorÚlabelé )Úfontsize)r Ú enumerateÚplotÚlegend)Úaxr r Zcontour_colorsZcontour_labelsÚ tolerancer r r# r r Úcontourr r r ÚPlotContours s :r'