here I am again.
ok, so I try to upload data using Omero.tables, but my plate is not in a dataset, only Ids I have are following:
screenId = 2
plateId = 2
imageId = 195
wellId = 116
so how do I attach data to this image?
link = omero.model.DatasetAnnotationLinkI()
link.setParent(omero.model.DatasetI(datasetId, False))
# Configuration
# =================================================================
screenId = 2
plateId = 2
imageId = 195
wellId = 116
# Create a name for the Original File (should be unique)
# =================================================================
from random import random
#tablename = "TablesDemo:%s" % str(random())
tablename = "image_data"
col1 = omero.grid.LongColumn('WellId', '', [])
col2 = omero.grid.LongColumn('CellCount', '', [])
columns = [col1, col2]
# Create and initialize a new table.
# =================================================================
repositoryId = 1
table = conn.c.sf.sharedResources().newTable(repositoryId, tablename)
table.initialize(columns)
#table.initialize(WellColumn)
# Add data to the table.
# =================================================================
well = [116, 158, 160, 149]
cellcount = [432, 562, 357, 283]
data1 = omero.grid.LongColumn('WellId', '', well)
data2 = omero.grid.LongColumn('CellCount', '', cellcount)
data = [data1, data2]
table.addData(data)
table.close() # when we're done, close.
# Get the table as an original file...
# =================================================================
orig_file = table.getOriginalFile()
orig_file_id = orig_file.id.val
# ...so you can attach this data to an object. E.g. Dataset
fileAnn = omero.model.FileAnnotationI()
fileAnn.setFile(omero.model.OriginalFileI(orig_file_id, False)) # use unloaded OriginalFileI
fileAnn = conn.getUpdateService().saveAndReturnObject(fileAnn)
link = omero.model.DatasetAnnotationLinkI()
link.setParent(omero.model.DatasetI(plateId, False))
link.setChild(omero.model.FileAnnotationI(fileAnn.id.val, False))
conn.getUpdateService().saveAndReturnObject(link)
No handlers could be found for logger "blitz_gateway"
WARNING:blitz_gateway:ValidationException on <class 'omero.gateway.OmeroGatewaySafeCallWrapper'> to <47298244-7ef3-4592-b2ea-835fcb79bbe0omero.api.IUpdate> saveAndReturnObject((object #0 (::omero::model::DatasetAnnotationLink)
{
_id = <nil>
_details = object #1 (::omero::model::Details)
{
_owner = <nil>
_group = <nil>
_creationEvent = <nil>
_updateEvent = <nil>
_permissions = <nil>
_externalInfo = <nil>
}
_loaded = True
_version = <nil>
_parent = object #2 (::omero::model::Dataset)
{
_id = object #3 (::omero::RLong)
{
_val = 2
}
_details = <nil>
_loaded = False
_version = <nil>
_projectLinksSeq = {}
_projectLinksLoaded = False
_projectLinksCountPerOwner = {}
_imageLinksSeq = {}
_imageLinksLoaded = False
_imageLinksCountPerOwner = {}
_annotationLinksSeq = {}
_annotationLinksLoaded = False
_annotationLinksCountPerOwner = {}
_name = <nil>
_description = <nil>
}
_child = object #4 (::omero::model::FileAnnotation)
{
_id = object #5 (::omero::RLong)
{
_val = 270
}
_details = <nil>
_loaded = False
_version = <nil>
_ns = <nil>
_description = <nil>
_annotationLinksSeq = {}
_annotationLinksLoaded = False
_annotationLinksCountPerOwner = {}
_file = <nil>
}
},), {})
Traceback (most recent call last):
File "/data/applications/OMERO.server-Beta-4.3.4/lib/python/omero/gateway/__init__.py", line 2956, in __call__
return self.f(*args, **kwargs)
File "/data/applications/OMERO.server-Beta-4.3.4/lib/python/omero_api_IUpdate_ice.py", line 97, in saveAndReturnObject
return _M_omero.api.IUpdate._op_saveAndReturnObject.invoke(self, ((obj, ), _ctx))
ValidationException: exception ::omero::ValidationException
{
serverStackTrace = ome.conditions.ValidationException: No row with the given identifier exists: [ome.model.containers.Dataset#2]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.model.containers.Dataset#2]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:663)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:117)
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 $Proxy77.saveAndReturnObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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 $Proxy77.saveAndReturnObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1532.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.UpdateI.saveAndReturnObject_async(UpdateI.java:64)
at omero.api._IUpdateTie.saveAndReturnObject_async(_IUpdateTie.java:92)
at omero.api._IUpdateDisp.___saveAndReturnObject(_IUpdateDisp.java:185)
at omero.api._IUpdateDisp.__dispatch(_IUpdateDisp.java:365)
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.ValidationException
message = No row with the given identifier exists: [ome.model.containers.Dataset#2]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.model.containers.Dataset#2]
}
Traceback (most recent call last):
File "test_tables.py", line 88, in ?
conn.getUpdateService().saveAndReturnObject(link)
File "/data/applications/OMERO.server-Beta-4.3.4/lib/python/omero/gateway/__init__.py", line 2959, in __call__
return self.handle_exception(e, *args, **kwargs)
File "/data/applications/OMERO.server-Beta-4.3.4/lib/python/omero/gateway/__init__.py", line 2956, in __call__
return self.f(*args, **kwargs)
File "/data/applications/OMERO.server-Beta-4.3.4/lib/python/omero_api_IUpdate_ice.py", line 97, in saveAndReturnObject
return _M_omero.api.IUpdate._op_saveAndReturnObject.invoke(self, ((obj, ), _ctx))
omero.ValidationException: exception ::omero::ValidationException
{
serverStackTrace = ome.conditions.ValidationException: No row with the given identifier exists: [ome.model.containers.Dataset#2]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.model.containers.Dataset#2]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:663)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:117)
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 $Proxy77.saveAndReturnObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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 $Proxy77.saveAndReturnObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1532.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.UpdateI.saveAndReturnObject_async(UpdateI.java:64)
at omero.api._IUpdateTie.saveAndReturnObject_async(_IUpdateTie.java:92)
at omero.api._IUpdateDisp.___saveAndReturnObject(_IUpdateDisp.java:185)
at omero.api._IUpdateDisp.__dispatch(_IUpdateDisp.java:365)
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.ValidationException
message = No row with the given identifier exists: [ome.model.containers.Dataset#2]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.model.containers.Dataset#2]
}
link = omero.model.DatasetAnnotationLinkI()
link.setParent(omero.model.DatasetI(plateId, False))
link = omero.model.PlateAnnotationLinkI()
link.setParent(omero.model.PlateI(plateId, False))
wmoore wrote:It should be noted that we don't really support the display of OMERO.tables data in our clients, so it's more of a storage facility for API access. However, we intend to improve support for OMERO.tables in our clients in due course.
Users browsing this forum: No registered users and 1 guest