gateway.getFacility() error in MATLAB
Posted: Thu Nov 01, 2018 12:08 pm
Hello, I'm trying to make use of OMERO Java gateway from within MATLAB. (Discussion http://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8593&sid=b68cbf8d65a77f4baaeaec9041c58dbf)
My loadOmeroGateway.m allows me to obtain omero.gateway.Gateway object.
https://gist.github.com/kouichi-c-nakamura/c8d335bfe45ee15e3bd86771a8578596
Now, for a trial, I want to retrieve an image in an OMERO server, according to this guide:https://docs.openmicroscopy.org/omero/5.4.9/developers/Java.html#read-data
What I was trying to do in MATLAB was below:
However, gateway.getFacility issues an error:
As far as I can see `omero.gateway.facility.BrowseFacility.class` returns a char type 'omero.gateway.facility.BrowseFacility' in MATLAB (.class is Java class literal). I guess this must be in a different type.
According to API documentation...
I guess the problem here might be related to the use of Generics <T>, but I don't really get what is supposed to be for type here. What is "Class<T> type"? Can someone give me any advice, please?
https://docs.oracle.com/javase/specs/jl ... jls-15.8.2
According to this, `omero.gateway.facility.BrowseFacility.class` must be in the type Class<BrowseFacility>, while in reality it's converted to char string by MATLAB. Is my understanding right?
I've just read the thread below in StackOverflow, and started to think that there may not be an easy solution for this one.
https://stackoverflow.com/questions/4463625/using-java-generic-classes-in-matlab
My loadOmeroGateway.m allows me to obtain omero.gateway.Gateway object.
https://gist.github.com/kouichi-c-nakamura/c8d335bfe45ee15e3bd86771a8578596
Now, for a trial, I want to retrieve an image in an OMERO server, according to this guide:https://docs.openmicroscopy.org/omero/5.4.9/developers/Java.html#read-data
What I was trying to do in MATLAB was below:
- Code: Select all
ctx = omero.gateway.SecurityContext(user.getGroupId());
imageId = 46629;
browse = gateway.getFacility(omero.gateway.facility.BrowseFacility.class);
image = browse.getImage(ctx, imageId);
However, gateway.getFacility issues an error:
- Code: Select all
No method 'getFacility' with matching signature found for class
'omero.gateway.Gateway'.
As far as I can see `omero.gateway.facility.BrowseFacility.class` returns a char type 'omero.gateway.facility.BrowseFacility' in MATLAB (.class is Java class literal). I guess this must be in a different type.
According to API documentation...
- Code: Select all
public <T extends Facility> T getFacility(Class<T> type)
I guess the problem here might be related to the use of Generics <T>, but I don't really get what is supposed to be for type here. What is "Class<T> type"? Can someone give me any advice, please?
https://docs.oracle.com/javase/specs/jl ... jls-15.8.2
The type of C.class, where C is the name of a class, interface, or array type (ยง4.3), is Class<C>.
According to this, `omero.gateway.facility.BrowseFacility.class` must be in the type Class<BrowseFacility>, while in reality it's converted to char string by MATLAB. Is my understanding right?
I've just read the thread below in StackOverflow, and started to think that there may not be an easy solution for this one.
https://stackoverflow.com/questions/4463625/using-java-generic-classes-in-matlab