Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_image_annotation only works https #131

Open
carissableker opened this issue Apr 6, 2024 · 1 comment
Open

add_image_annotation only works https #131

carissableker opened this issue Apr 6, 2024 · 1 comment

Comments

@carissableker
Copy link

carissableker commented Apr 6, 2024

Hi,

I am trying to load a background annotation (image) to my network. Using

p4c.add_annotation_image(url="https://www.ucsd.edu/_resources/img/logo_UCSD.png", network)

works: the logo is loaded, I can also view it in the ImageManager, the output is as expected

{'edgeThickness': '1.0',
 'canvas': 'foreground',
 'rotation': '0.0',
 'type': 'org.cytoscape.view.presentation.annotations.ImageAnnotation',
 'uuid': '5105cc4c-9dcd-4121-bd22-4c7631652ed9',
 'URL': 'https://www.ucsd.edu/_resources/img/logo_UCSD.png',
 'shapeType': 'RECTANGLE',
 'edgeColor': '#000000',
 'brightness': '0',
 'edgeOpacity': '100.0',
 'contrast': '0',
 'name': 'Image 5',
 'x': '140.44609144134952',
 'width': '500.0',
 'y': '-87.37795634841291',
 'z': '1',
 'opacity': '1.0',
 'height': '100.0'}

using

p4c.add_annotation_image(url="http://www.ucsd.edu/_resources/img/logo_UCSD.png", network)
or (after downloading the image)
p4c.add_annotation_image(url="images/logo_UCSD.png", network)
or
p4c.add_annotation_image(url="file:images/logo_UCSD.png", network)
or
p4c.add_annotation_image(url="/absolute/path/images/logo_UCSD.png", network)

creates an empty rectangle in the network with the output:

{'edgeThickness': '1.0',
 'canvas': 'foreground',
 'rotation': '0.0',
 'type': 'org.cytoscape.view.presentation.annotations.ImageAnnotation',
 'uuid': '74c2b263-fcd4-4def-bf94-fdffad2b55fa',
 'shapeType': 'RECTANGLE',
 'edgeColor': '#000000',
 'brightness': '0',
 'edgeOpacity': '100.0',
 'contrast': '0',
 'name': 'Image 5',
 'x': '-28.22070147718013',
 'width': '100.0',
 'y': '-99.1472863452772',
 'z': '1',
 'opacity': '1.0',
 'height': '100.0'}

is missing the URL.

Using Cytoscape 3.10 or 3.10.2 with py4cytoscape 1.9.0 on Ubuntu.

Not sure if this is a local issue or not.

@bdemchak
Copy link
Collaborator

Hi, Carissa --

I tried this in the Cytoscape GUI ... and chose the background layer, which I assume you mean to do (??).

With a little work, I got Cytoscape to show a logo file (UCSD-Jacobs School) as a background annotation.

The URL I used was file:///C:/Users/bdemc/Desktop/UCSD-Jacobs.png ... note the "file:///" preceding the path.

Confession: I didn't use py4cytoscape to do this ... I directly edited the session file and reloaded the session. (If you'd like to know the exact mechanics, I can burden you.) Still, I'd expect the same result by using py4cytoscape.

What do you think??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants