[ome-users] matlab accessing shared data

Josh Moore josh at glencoesoftware.com
Mon Jan 23 19:23:05 GMT 2012


Thanks to both of you for looking into this. Just as a follow-up, the use of 'omero.model.Project' works fine in 2007b as well, so it may make more sense for us to change our examples to the string usage [#7881].
~J

[#7881] https://trac.openmicroscopy.org.uk/ome/ticket/7881

On Jan 23, 2012, at 4:26 PM, Alexander Tournier wrote:

> Hi Seb,
> 
> just saw your email ... thanks it solves the problem!
> Won't ask why!
> 
> Thanks
> Alex
> 
> 
> 
> On 23/01/12 14:02, Sebastien Besson wrote:
>> Hi Alex,
>> 
>> I encountered the exact same problem using Matlab 2011a. To fix that,
>> try to use the following syntax instead (works for datasets and other
>> classes as well)
>> 
>> projectsList = proxy.loadContainerHierarchy('omero.model.Project', [],
>> param);
>> 
>> Best,
>> Sebastien
>> 
>> On Mon, 2012-01-23 at 08:56 -0500, Josh Moore wrote:
>>> On Jan 23, 2012, at 12:32 PM, Alexander Tournier wrote:
>>> 
>>>> Thanks Josh and Jmarie,
>>>> 
>>>> I've looked at the doc you sent me and am now trying to move away from using the gateway service and use the ContainerService instead.
>>>> 
>>>> I've been playing with the demo matlab scripts and I get a weird error after:
>>>> projectsList = proxy.loadContainerHierarchy(omero.model.Project.class, [], param);
>>>> The error message is:
>>>> The class omero.model.Project has no property or method named 'class'.
>>> That really is bizarre. I just copied and pasted your code into my Matlab 2007b instance and it worked fine. What version are you using?
>>> 
>>> ~Josh
>>> 
>>>> The omero class is loaded correctly so I'm at a loss here.
>>>> I am using the current 4.3.3 release
>>>> 
>>>> Minimal script:
>>>> addpath('/farm/home/tourni01/Projects/2-ImageAnalysis/13-OME/OMERO.matlab-4.3.3')
>>>> OmeroClient_Jar = fullfile(findOmero, 'omero_client.jar');
>>>> javaaddpath(OmeroClient_Jar);
>>>> import omero.*;
>>>> 
>>>> ice_config = fullfile(findOmero, 'ice.config');
>>>> args = javaArray('java.lang.String',1);
>>>> args(1) = java.lang.String(['--Ice.Config=',ice_config]);
>>>> client = omero.client(args);
>>>> session = client.createSession();
>>>> t = omeroKeepAlive(client);
>>>> 
>>>> userId = session.getAdminService().getEventContext().userId
>>>> groupId = session.getAdminService().getEventContext().groupId
>>>> 
>>>> proxy = session.getContainerService();
>>>> 
>>>> param = omero.sys.ParametersI();
>>>> param.noLeaves();%indicate not to load the images
>>>> param.exp(omero.rtypes.rlong(userId));
>>>> 
>>>> projectsList = proxy.loadContainerHierarchy(omero.model.Project.class, [], param);
>>>> 
>>>> Any ideas??
>>>> Thanks,
>>>> Alex
>>>> 
>>>> 
>>>> 
>>>> On 20/01/12 20:03, Josh Moore wrote:
>>>>> 
>>>>> On Jan 19, 2012, at 4:51 PM, Josh Moore wrote:
>>>>> 
>>>>>> Forwarding to the list.
>>>>>> 
>>>>>> On Jan 19, 2012, at 4:49 PM, Alexander Tournier wrote:
>>>>>> 
>>>>>>> Hi Josh,
>>>>> Hi Alex,
>>>>> 
>>>>>>> thanks for your answer.
>>>>>>> I'm still stuck.
>>>>>>> I'm using getProjects from the createGateway service, this lists all my projects (in the collaborative group) but not my collaborators.
>>>>> In 4.4, we will be suggesting every move away from use of GatewayPrx.
>>>>> 
>>>>>>> I've been looking into
>>>>>>> http://trac.openmicroscopy.org.uk/ome/wiki/OmeroApi
>>>>> Instead, take a look at http://hudson.openmicroscopy.org.uk/job/OMERO/javadoc/ome/api/IContainer.html
>>>>> 
>>>>> Examples of its use are available under:
>>>>> 
>>>>>    https://github.com/openmicroscopy/openmicroscopy/blob/develop/examples/Training/java/src/training/ReadData.java
>>>>> 
>>>>> Hope that helps.
>>>>> Cheers,
>>>>> ~Josh
>>>>> 
>>>>>>> To find out about it's limitations but can't find any documentation on it.
>>>>>>> Am I looking in the best place for this??
>>>>>>> 
>>>>>>> Thanks
>>>>>>> Alex
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On 16/01/12 08:28, Josh Moore wrote:
>>>>>>>> On Jan 13, 2012, at 3:17 PM, Alexander Tournier wrote:
>>>>>>>> 
>>>>>>>>> Hi there,
>>>>>>>> Hi Alexander,
>>>>>>>> 
>>>>>>>>> I'm using matlab to access/analyse and store processed images.
>>>>>>>>> I can now access my own data but can't access the data shared in the same (which I can access in OMERO.insight).
>>>>>>>>> 
>>>>>>>>> - is there a way to specify in matlab which group one wants to access (currently have to go into OMERO.Insight and change it there, this seems to carry across to what matlab can see)
>>>>>>>> There are several options.
>>>>>>>> 
>>>>>>>> * In your ice.config file you can set omero.group to the group id that you want to be logged into.
>>>>>>>> 
>>>>>>>> * You can pass omero.group in to loadOmero:
>>>>>>>> 
>>>>>>>>>> p = java.util.Properties();
>>>>>>>>>> p.setProperty('omero.group','your-group');
>>>>>>>>>> p.setProperty('omero.host','localhost');
>>>>>>>>>> p.setProperty('omero.user','root');
>>>>>>>>>> p.setProperty('omero.pass','SECRET');
>>>>>>>>>> [c,s] = loadOmero(p);
>>>>>>>>>> s.getAdminService().getEventContext().groupName
>>>>>>>> ans =
>>>>>>>> 
>>>>>>>> default
>>>>>>>> 
>>>>>>>> * You can call session.setSecurityContext after logging in:
>>>>>>>> 
>>>>>>>>>> import omero.model.ExperimenterGroupI
>>>>>>>>>> s.setSecurityContext(omero.model.ExperimenterGroupI(0, false));
>>>>>>>>>> s.getAdminService().getEventContext().groupName
>>>>>>>> ans =
>>>>>>>> 
>>>>>>>> system
>>>>>>>> 
>>>>>>>> * Or you can use s.getAdminService().setDefaultGroup(experimenterObj, groupObj);
>>>>>>>> 
>>>>>>>> which will change persistently which group you log-in as if no "omero.group" value is passed, just as if you had made the change in, say, WebAdmin. However, that shouldn't be done overly frequently, so it's probably best done in one of the UIs.
>>>>>>>> 
>>>>>>>>> - how can I access from within matlab data from collaborators (shared data) in the same group as myself.
>>>>>>>> Once you are logged into a group that is collaborative, service methods will begin returning shared data as well as your own, unless the JavaDocs specifically state that it's a method which returns only your own data.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> Many thanks,
>>>>>>>>> Alex
>>>>>>>> Cheers,
>>>>>>>> ~Josh.




More information about the ome-users mailing list