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

How can we make a request to the image server now ? #5

Open
vannary opened this issue Mar 3, 2020 · 3 comments
Open

How can we make a request to the image server now ? #5

vannary opened this issue Mar 3, 2020 · 3 comments

Comments

@vannary
Copy link

vannary commented Mar 3, 2020

Here is our previous command:
https://research.cytomine.be/api/abstractimage/10828059/imageservers.json

The code error is 403.

@urubens
Copy link

urubens commented Mar 3, 2020

Hi,
If you have a 403 error, it means you don't have rights to access the resource. Are you sure your are authenticated in your browser when requesting this URL ?

Anyway, this service is now deprecated. With the last Cytomine-ULiege version, an Image Instance has a collection of slices (SliceInstance) so that an image can hold several C,Z,T planes. In the case of a regular 2D image, the collection has only one item (0,0,0) . The slice instance has the attributes:

  • imageServerUrl
  • path

These 2 attributes help you to get what was returned by the now deprecated imageservers.json request:

 imageServer = ${slice.imageServerUrl}/slice/tile?zoomify=${slice.path}

To get these attributes with the Java Client you have to use at least the v2.2.0 release of this repo. The result can be achieved like this:

int image_id = 123
Collection<SliceInstance> c = new Collection<>(SliceInstance.class, 0,0);
        c.addFilter("imageinstance", String.valueOf(image_id));
        c.fetch();

        for (int i = 0; i < c.size(); i++) {
            System.out.println(c.get(i).getStr("imageServerUrl"));
            System.out.println(c.get(i).getStr("path"));
            System.out.println(c.get(i).getStr("imageServerUrl") + "/slice/tile?zoomify=" + c.get(i).getStr("path"));
        }

@vannary
Copy link
Author

vannary commented Mar 5, 2020 via email

@urubens
Copy link

urubens commented Mar 5, 2020

public BufferedImage getPictureAsBufferedImage(String url, String format) throws CytomineException {
should do the trick

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