util/utils.py
def extract_bounding_boxes(associations: list, concept: str, observation_uuid: str, im_ref_filter: str = None):
    """
    Yield source bounding box objects from a JSON list of associations
    :param associations: JSON list of associations
    :param concept: Concept to attach to each source bounding box
    :param observation_uuid: Observation UUID to attach to box
    :param im_ref_filter: Optional filter for bounding boxes tied to a particular image reference
    :return: Generator object for bounding boxes
    """
    for association in associations:  # Generate source bounding boxes
        if association['link_name'] != 'bounding box':
            continue

        box_json = json.loads(association['link_value'])
        if im_ref_filter and box_json['image_reference_uuid'] == im_ref_filter:
            yield SourceBoundingBox(  # Create source box
                box_json,
                concept,
                box_json['observer'],
                box_json['strength'],
                observation_uuid=observation_uuid,
                association_uuid=association['uuid'],
                part=association['to_concept']
            )

    Yield source bounding box objects from a JSON list of associations
    :param associations: JSON list of associations
    :param concept: Concept to attach to each source bounding box
    :param observation_uuid: Observation UUID to attach to box
    :param im_ref_filter: Optional filter for bounding boxes tied to a particular image reference
    :return: Generator object for bounding boxes
    
Yield source bounding box objects from a JSON list of associations
Yield source bounding box objects from a JSON list of associations
def extract_bounding_boxes(associations: list, concept: str, observation_uuid: str, im_ref_filter: str = None):
    for association in associations:  
        if association['link_name'] != 'bounding box':
            continue
        box_json = json.loads(association['link_value'])
        if im_ref_filter and box_json['image_reference_uuid'] == im_ref_filter:
            yield SourceBoundingBox(  
                box_json,
                concept,
                box_json['observer'],
                box_json['strength'],
                observation_uuid=observation_uuid,
                association_uuid=association['uuid'],
                part=association['to_concept']
            )
def extract_bounding_boxes ( associations : list , concept : str , observation_uuid : str , im_ref_filter : str = None ) : for association in associations : if association [ 'link_name' ] != 'bounding box' : continue box_json = json . loads ( association [ 'link_value' ] ) if im_ref_filter and box_json [ 'image_reference_uuid' ] == im_ref_filter : yield SourceBoundingBox ( box_json , concept , box_json [ 'observer' ] , box_json [ 'strength' ] , observation_uuid = observation_uuid , association_uuid = association [ 'uuid' ] , part = association [ 'to_concept' ] )
Yield source bounding box objects from a JSON list of associations
Yield source bounding box objects from a JSON list of associations
"""
    Yield source bounding box objects from a JSON list of associations
    :param associations: JSON list of associations
    :param concept: Concept to attach to each source bounding box
    :param observation_uuid: Observation UUID to attach to box
    :param im_ref_filter: Optional filter for bounding boxes tied to a particular image reference
    :return: Generator object for bounding boxes
    """ # Generate source bounding boxes # Create source box
Generator object for bounding boxes
Generator object for bounding boxes
associations
list
JSON list of associations
JSON list of associations
concept
str
Concept to attach to each source bounding box
Concept to attach to each source bounding box
observation_uuid
str
Observation UUID to attach to box
Observation UUID to attach to box
im_ref_filter
str
Optional filter for bounding boxes tied to a particular image reference
Optional filter for bounding boxes tied to a particular image reference