get_all_ids
FunctionSource
ids: [str] = get_all_ids(data: Annotations | [AnnoItem])
Get the list of all IDs in the annotation data. The returne IDs are ordered as the
order of the items in data.
Aliases
This function can be acquired by
import dash_picture_annotation as dpa
dpa.get_all_ids
dpa.utilities.get_all_ids
Arguments
Requires
| Argument | Type | Required | |
|---|---|---|---|
data | Annotations | [AnnoItem] | The annotation data that is checked. |
Returns
| Argument | Type | |
|---|---|---|
ids | [str] | The ordered IDs of the annotation items in the data. |
Examples
Get all IDs of the data
- Codes
- Results
get_all_ids.py
import pprint
import dash_picture_annotation as dpa
data = [
{"id": "a", "mark": {"x": 0, "y": 0, "width": 0, "height": 0, "type": "RECT"}},
{"id": "b", "mark": {"x": 0, "y": 0, "width": 0, "height": 0, "type": "RECT"}},
{"mark": {"x": 0, "y": 0, "width": 0, "height": 0, "type": "RECT"}},
{"id": "c", "mark": {"x": 0, "y": 0, "width": 0, "height": 0, "type": "RECT"}},
{"id": "c", "mark": {"x": 1, "y": 1, "width": 0, "height": 0, "type": "RECT"}},
]
data_wrapped = {"timestamp": 0, "data": data}
pprint.pprint(dpa.get_all_ids(data))
pprint.pprint(dpa.get_all_ids(data_wrapped))
('a', 'b', 'c', 'c')
('a', 'b', 'c', 'c')