[ome-users] matlab accessing shared data

Alexander Tournier alexander.tournier at cancer.org.uk
Mon Jan 23 15:24:17 GMT 2012


On 23/01/12 13:47, 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?

I'm on 2011b.
I've gone a bit further:
- there is no error on the first call to proxy.loadContainerHierarchy, 
however any subsequent call throws 'The class omero.model.Project has no 
property or method named 'class'.'
- I tried it in Matlab 2007a and multiple calls do not throw the same error.

Now for the really weird!
if I execute it all in one go, i can even have delays such as below, and 
it works:
for i = 1:100
     projectsList = 
proxy.loadContainerHierarchy(omero.model.Project.class, [], param)
     pause(10)
end

as soon as Matlab returns from execution no further reference to 
omero.model.Project.class can be made (although it works in 2007a).

It seems that when matlab returns from executing a set of instructions 
it does something which deletes the omero.model.Project.class object

No need to say, I have no clue how to go ahead with this!
And no unfortunately I can't just use 2007a all the time!

Any ideas,
Best,
Alex


>
> ~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.


NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose. 

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you. 
Cancer Research UK
Registered in England and Wales
Company Registered Number: 4325234.
Registered Charity Number: 1089464 and Scotland SC041666
Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.



More information about the ome-users mailing list