py4cytoscape.annotations.update_annotation_image

update_annotation_image(url=None, annotation_name=None, x_pos=None, y_pos=None, angle=None, opacity=None, brightness=None, contrast=None, border_thickness=None, border_color=None, border_opacity=None, height=None, width=None, name=None, canvas=None, z_order=None, network=None, base_url='http://127.0.0.1:1234/v1')[source]

Update Image Annotation

Updates an image annotation in a Cytoscape network view. The object will also be updated in the Annotation Panel in the GUI.

Parameters
  • url (str) – URL or path to image file. File paths can be absolute or relative to current working directory or sandbox. URLs must start with http:// or https://.

  • annotation_name (UUID or str) – Name of annotation by UUID or name

  • x_pos (int) – X position in pixels from left; default is center of current view

  • y_pos (int) – Y position in pixels from top; default is center of current view

  • angle (float) – Angle of text orientation; default is 0.0 (horizontal)

  • opacity (int) – Opacity of fill color. Must be an integer between 0 and 100; default is 100

  • brightness (int) – Image brightness. Must be an integer between -100 and 100; default is 0.

  • contrast (int) – Image contrast. Must be an integer between -100 and 100; default is 0.

  • border_thickness (int) – non-negative integer

  • border_color (str) – hexadecimal color; default is #000000 (black)

  • border_opacity (int) – Integer between 0 and 100; default is 100

  • height (int) – Height of bounding shape; default is based on text height

  • width (int) –

  • name (str) – Name of annotation object; default is “Text”

  • canvas (str) – Canvas to display annotation, i.e., foreground (default) or background

  • z_order (int) – Arrangement order specified by number (larger values are in front of smaller values); default is 0

  • network (SUID or str or None) – Name or SUID of the network. Default is the “current” network active in Cytoscape.

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

A named list of annotation properties, including UUID

Return type

dict

Raises
  • CyError – if network name doesn’t exist or error in parameter value

  • requests.exceptions.HTTPError – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> update_annotation_image(url='https://www.ucsd.edu/_resources/img/logo_UCSD.png', annotation_name='ann1 name')
{'edgeThickness': '1.0', 'canvas': 'foreground', 'rotation': '0.0', 'type': 'org.cytoscape.view.presentation.annotations.ImageAnnotation', 'uuid': 'd5e1e147-7515-4255-a0d2-4047a9514313', 'URL': 'https://www.ucsd.edu/_resources/img/logo_UCSD.png', 'shapeType': 'RECTANGLE', 'edgeColor': '#000000', 'brightness': '0', 'edgeOpacity': '100.0', 'contrast': '0', 'name': 'ann1 name', 'x': '2449.9784057344455', 'width': '500.0', 'y': '1882.9888145962157', 'z': '0', 'opacity': '1.0', 'height': '100.0'}
>>> update_annotation_image(url='http://www.ucsd.edu/_resources/img/logo_UCSD.png', annotation_name='ann1 name', x_pos=101, y_pos=201, angle=90, opacity=51, brightness=61, contrast=71, border_thickness=3, border_color='#0F0F0E', border_opacity=76, height=31, width=32, name='ann1a name', canvas='foreground')
{'edgeThickness': '3.0', 'canvas': 'foreground', 'rotation': '90.0', 'type': 'org.cytoscape.view.presentation.annotations.ImageAnnotation', 'uuid': 'b3435db0-2468-408f-a9ef-d4232ed5ea56', 'URL': 'http://www.ucsd.edu/_resources/img/logo_UCSD.png', 'shapeType': 'RECTANGLE', 'edgeColor': '#0F0F0E', 'brightness': '61', 'edgeOpacity': '76.0', 'contrast': '71', 'name': 'ann1a name', 'x': '101.0', 'width': '32.0', 'y': '201.0', 'z': '0', 'opacity': '0.51', 'height': '31.0'}