Hi @iacisme the shape has a name
attribute which you can use to identify shapes in your image. It is actually not intended for this, see also here. I used it in the past for finding shapes in an image by iterating thru the list of annotations.
Here an example:
base_shape = {
'editable': True,
'xref': 'x',
'yref': 'y',
'layer': 'above',
'opacity': 1,
'line':
{
'color': '#E2F714', # default color
'width': 2,
'dash': 'solid'
},
'fillcolor': 'rgba(0, 0, 0, 0)',
'fillrule': 'evenodd',
'type': 'rect',
'x0': 0, # default values
'y0': 0,
'x1': 0,
'y1': 0,
'name': 'default_name'
}
Deleting the shapes is as easy as deleting an item from a list after finding the correct index (searching for the name).