ome / omero-matlab

Toolbox for accessing OMERO from MATLAB
GNU General Public License v2.0
0 stars 6 forks source link

Accept Gateway objects in all functions #5

Open joshmoore opened 6 years ago

joshmoore commented 6 years ago

Either as a breaking change or via:

 function planeInfo = getPlaneInfo(session_or_gateway,

all toolbox functions should be able to make use of the higher-level omero.gateway functionality.

cF. https://github.com/openmicroscopy/openmicroscopy/tree/develop/components/blitz/src/omero/gateway

sbesson commented 5 years ago

If we were going for a v2 of this toolbox using the gateway, an alternative would be to namespace the OMERO.matlab methods e.g. omero.matlab.getPlaneInfo(gateway,...) and maintain the previous signatures in the legacy functions. This would have the advantage of reducing conflicts with other packages containing the same method/function names - see https://www.openmicroscopy.org/community/viewtopic.php?t=8593&p=20035#p20035 for an example.

joshmoore commented 5 years ago

Regardless of the introduction of gateway, I can definitely see the benefit of namespacing (perhaps including a version number).

kouichi-c-nakamura commented 5 years ago

Hello,

I'm trying to extend writeMapAnnotation.m

ma = writeMapAnnotation(session, keys, values, varargin)

to accept gateway as well instead of session:

ma = writeMapAnnotation(gateway, keys, values, varargin)

I then realized that later in the function, when I need SecurityContext as in

ctx = omero.gateway.SecurityContext(user.getGroupId());,

I actually need user to be passed to the function alongside with gateway.

What syntax should we use then?

  1. ma = writeMapAnnotation({gateway, user}, keys, values, varargin)
  2. ma = writeMapAnnotation(gateway, keys, values, user, varargin)
  3. ma = writeMapAnnotation(gateway, user, keys, values, varargin)
  4. or else?

In the example below, I used the syntax of ma = writeMapAnnotation(gateway, keys, values, 'group', groupid). Can we use a default value for groupid?

https://gist.github.com/kouichi-c-nakamura/eab6f24f4f4b770c2e156b1c207112ee#file-writemapannotation-m-L101

I've posted essentially the same topic to a forum below: http://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8669&p=20496#p20496

cf. loadOmeroGateway works with a Bio-Formats MATLAB toolbox. Someone in the OME commented that this dependency is too much, so I haven't made a Pull Request yet.