[ome-users] loading data frmo matlab to an Image in OMERO in two phases

Will Moore will at lifesci.dundee.ac.uk
Thu Aug 4 15:14:37 BST 2011


Hi Alex,

  To delete Images (and other stuff), use the delete service.

This handles graph-based delete, deleting all linked objects under  
Image etc.
You only need to specify whether you want various annotations to be  
deleted if they become 'orphaned'.
Here's some Python code. Hopefully you can convert to Java / Matlab?

   Will.


deleteService = serviceFactory.getDeleteService()

imgId = 12704

keepOphanedAnnotations = False

if keepOphanedAnnotations:
     options = {
         "/TagAnnotation":"KEEP",
         "/TermAnnotation":"KEEP",
         "/FileAnnotation":"KEEP"
         }
else:
     options = None

dcs = list()
dcs.append(omero.api.delete.DeleteCommand("/Image", long(imgId),  
options))
handle = deleteService.queueDelete(dcs)



On 4 Aug 2011, at 14:16, Alexander Tournier wrote:

> Hi Will,
> thanks for that, good to hear that it's a know issue.
> Kind of make sense from your explanations.
>
> One way I've found is to rewrite the whole image each time.
> However, I haven't found a way of deleting the redundant/old images.
> Would you have a script to delete image files?
>
> Thanks,
> Alex
>
>
>
> On 04/08/11 13:21, Will Moore wrote:
>> Hi Alex,
>>
>> Sorry for the delay - this one kinda slipped through the net...
>>
>> Once an image is created, with pixel data (either via import, or  
>> after
>> the first use of rawPixelsStore) then you cannot modify the pixel  
>> data
>> again.
>> A bunch of statistics are calculated, E.g. min&  max for each  
>> channel,
>> checksum or hash of the pixels object on disk etc and these cannot
>> currently be updated.
>>
>> You will see the same error if you try to modify the pixels of any
>> existing image in OMERO.
>>
>> Your options depend on how distinct the sessions are for writing  
>> data.
>> If it's possibly to use the same session (rawPixelsStore) then that
>> could work.
>> If you need to write the data in a number of different transactions,
>> then one option may be to write a separate image each time, then
>> stitch them together when you're done.
>> E.g. Combine_Images.py script (although this script doesn't support
>> combining of multi-T images into a longer movie, but it could be used
>> to stitch together individual timepoints.
>> Or you could write your own code to stitch together the images.
>>
>> Sorry we can't be more helpful just now,
>>
>>    Will.
>>
>>
>> On 28 Jul 2011, at 12:07, Alexander Tournier wrote:
>>
>>> Hi All,
>>>
>>> I want to write data to OMERO Images, however sometimes I don't have
>>> all the data at that time.
>>> So say I load up timeframes 1 to 10 in one go and 11 to 20 later,
>>> for example.
>>>
>>> However, when I try to 'open' the image object a second time I get a
>>> long error message.
>>> I've written a short script to show this, attached, error message
>>> below.
>>>
>>> The way I'm doing it now is keeping hold of the rawPixelsStore
>>> instance, so I can write to the image as long as I have that. Now
>>> that only works within one matlab session.
>>>
>>> Any ideas how to go about this/what I'm doing wrong?
>>> Thanks,
>>> Alex
>>>
>>>
>>> ??? Java exception occurred:
>>> omero.ApiUsageException
>>>    serverStackTrace = "ome.conditions.ApiUsageException: Write-
>>> method not permitted.
>>>                            at
>>>
>>> ome.io.nio.RomioPixelBuffer.throwIfReadOnly(RomioPixelBuffer.java: 
>>> 109)
>>>                                                            at
>>>
>>> ome.io.nio.RomioPixelBuffer.setPlane(RomioPixelBuffer.java:666)
>>>                                                            at
>>>
>>> ome.services.RawPixelsBean.setPlane(RawPixelsBean.java:564)
>>>                                                            at
>>>
>>> sun.reflect.GeneratedMethodAccessor1483.invoke(Unknown
>>>                                Source)
>>>                            at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:43)
>>>                                                            at
>>>
>>> java.lang.reflect.Method.invoke(Method.java:616)
>>>                            at
>>>
>>> org
>>> .springframework
>>> .aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:
>>> 307)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation
>>> .invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 150)
>>>                                                            at
>>>
>>> ome.security.basic.EventHandler.invoke(EventHandler.java:150)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> ome.tools.hibernate.SessionHandler.doStateful(SessionHandler.java: 
>>> 182)
>>>                                                            at
>>>
>>> ome.tools.hibernate.SessionHandler.invoke(SessionHandler.java:166)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .transaction
>>> .interceptor
>>> .TransactionInterceptor.invoke(TransactionInterceptor.java:108)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>                                 
>>> ome.tools.hibernate.ProxyCleanupFilter
>>> $Interceptor.invoke(ProxyCleanupFilter.java:231)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> ome.services.util.ServiceHandler.invoke(ServiceHandler.java:116)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java: 
>>> 202)
>>>                                                            at
>>>                                $Proxy85.setPlane(Unknown Source)
>>>                            at
>>> sun.reflect.GeneratedMethodAccessor1483.invoke(Unknown
>>>                                Source)
>>>                            at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:43)
>>>                                                            at
>>>
>>> java.lang.reflect.Method.invoke(Method.java:616)
>>>                            at
>>>
>>> org
>>> .springframework
>>> .aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:
>>> 307)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation
>>> .invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 150)
>>>                                                            at
>>>
>>> ome
>>> .security.basic.BasicSecurityWiring.invoke(BasicSecurityWiring.java:
>>> 83)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> ome
>>> .services
>>> .blitz.fire.AopContextInitializer.invoke(AopContextInitializer.java:
>>> 43)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop
>>> .framework
>>> .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
>>> 172)
>>>                                                            at
>>>
>>> org
>>> .springframework
>>> .aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java: 
>>> 202)
>>>                                                            at
>>>                                $Proxy85.setPlane(Unknown Source)
>>>                            at
>>> sun.reflect.GeneratedMethodAccessor1486.invoke(Unknown
>>>                                Source)
>>>                            at
>>>
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:43)
>>>                                                            at
>>>
>>> java.lang.reflect.Method.invoke(Method.java:616)
>>>                            at
>>>
>>> ome
>>> .services.blitz.util.IceMethodInvoker.invoke(IceMethodInvoker.java:
>>> 179)
>>>                                                            at
>>>
>>> ome.services.throttling.Callback.run(Callback.java:56)
>>>                            at
>>>
>>> ome
>>> .services
>>> .throttling
>>> .InThreadThrottlingStrategy
>>> .callInvokerOnRawArgs(InThreadThrottlingStrategy.java:56)
>>>                                                            at
>>>
>>> ome
>>> .services
>>> .blitz
>>> .impl
>>> .AbstractAmdServant.callInvokerOnRawArgs(AbstractAmdServant.java: 
>>> 136)
>>>                                                            at
>>>
>>> ome
>>> .services
>>> .blitz.impl.RawPixelsStoreI.setPlane_async(RawPixelsStoreI.java:211)
>>>                                                            at
>>>
>>> omero.api._RawPixelsStoreTie.setPlane_async(_RawPixelsStoreTie.java:
>>> 281)
>>>                                                            at
>>>
>>> omero.api._RawPixelsStoreDisp.___setPlane(_RawPixelsStoreDisp.java:
>>> 943)
>>>                                                            at
>>>
>>> omero.api._RawPixelsStoreDisp.__dispatch(_RawPixelsStoreDisp.java:
>>> 1301)
>>>                                                            at
>>>
>>> IceInternal.Incoming.invoke(Incoming.java:159)
>>>                            at
>>> Ice.ConnectionI.invokeAll(ConnectionI.java:2037)
>>>                            at
>>> Ice.ConnectionI.message(ConnectionI.java:972)
>>>                            at
>>> IceInternal.ThreadPool.run(ThreadPool.java:577)
>>>                            at IceInternal.ThreadPool.access
>>> $100(ThreadPool.java:12)
>>>                            at
>>>                                IceInternal.ThreadPool
>>> $EventHandlerThread.run(ThreadPool.java:971)
>>>                                                        "
>>>    serverExceptionClass = "ome.conditions.ApiUsageException"
>>>    message = "Write-method not permitted."
>>>    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>> Method)
>>>    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
>>> Source)
>>>    at
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
>>> Source)
>>>    at java.lang.reflect.Constructor.newInstance(Unknown Source)
>>>    at java.lang.Class.newInstance0(Unknown Source)
>>>    at java.lang.Class.newInstance(Unknown Source)
>>>    at
>>>        IceInternal.BasicStream
>>> $DynamicUserExceptionFactory.createAndThrow(BasicStream.java:2243)
>>>            at
>>> IceInternal.BasicStream.throwException(BasicStream.java:1632)
>>>    at IceInternal.Outgoing.throwUserException(Outgoing.java:442)
>>>    at
>>> omero.api._RawPixelsStoreDelM.setPlane(_RawPixelsStoreDelM.java: 
>>> 1566)
>>>    at
>>> omero
>>> .api.RawPixelsStorePrxHelper.setPlane(RawPixelsStorePrxHelper.java:
>>> 2159)
>>>    at
>>> omero
>>> .api.RawPixelsStorePrxHelper.setPlane(RawPixelsStorePrxHelper.java:
>>> 2131)
>>>
>>>
>>>
>>> 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.<bugtest2.m>_______________________________________________
>>> ome-users mailing list
>>> ome-users at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>> William Moore
>> Wellcome Trust Centre for Gene Regulation&  Expression
>> College of Life Sciences
>> MSI/WTB/JBC Complex
>> University of Dundee
>> Dow Street
>> Dundee  DD1 5EH
>> United Kingdom
>>
>> Phone 01382 386364
>> http://openmicroscopy.org
>>
>>
>>
>>
>>
>
>
> 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.

William Moore
Wellcome Trust Centre for Gene Regulation & Expression
College of Life Sciences
MSI/WTB/JBC Complex
University of Dundee
Dow Street
Dundee  DD1 5EH
United Kingdom

Phone 01382 386364
http://openmicroscopy.org








More information about the ome-users mailing list