[ome-devel] basic python api questions.
josh.moore at gmx.de
josh.moore at gmx.de
Mon Jun 15 12:15:40 BST 2009
Forwarding to list for Gianluigi...
The only current example of how this could be done, Gianluigi, is via
the DeltaVision class:
https://trac.openmicroscopy.org.uk/omero/browser/trunk/components/romio/src/ome/io/nio/DeltaVision.java
this gets exposed to the client developer via
RawPixelsStore.setPixelsId( pixelsId, bypassOriginalFile):
https://trac.openmicroscopy.org.uk/omero/browser/trunk/components/server/src/ome/services/RawPixelsBean.java#L169
which calls:
https://trac.openmicroscopy.org.uk/omero/browser/trunk/components/romio/src/ome/io/nio/PixelsService.java#L86
Each Pixels object has a list of links to OriginalFile instances. The
PixelsService can choose to use the OriginalFile directly.
As you can see, we'll need to make the PixelsService.getPixelBuffer()
method more flexible for you to inject your PixelBuffer factory. But
if you start out by adding an omero.model.OriginalFile with an
omero.model.Format instance value of "HDFS" (or similar), then your
PixelBuffer implementation should have all it needs to get
started. You can create the Format instance via
omero.api.ITypes.createEnumeration.
Hope that helps,
~Josh.
zag at crs4.it writes:
> Hi Josh.
>
> I need some help on omero python api.
> As we discussed in Paris, I would like to glue omero to our repository
> of images stored in hdfs.
> I expect to handle that by loading into omero images that have some
> property that can be used by PixelsService to decide what PixelBuffer
> class it needs to instantiate.
>
> However, I am lost on the details.
> For instance, it appears that I can create images, see below, but how do
> I attach attributes to the images so that PixelsService will know what
> to do? Also, is this the right way to do it? I could not find an
> example.
>
> --gianluigi
>
> #-----------------------------------------------
> import sys
> import time
>
> sys.path.append('/opt/omero/lib/python')
>
> import omero as om
> import omero.rtypes as omt
>
> c = om.client("localhost")
> try:
> i = om.model.ImageI()
> i.name = omt.rstring('barfoo')
> i.acquisitionDate = omt.rtime(time.time() * 1000)
> p = om.model.PixelsI()
> p.setSizeX(omt.rint(16))
> p.setSizeY(omt.rint(32))
> p.setSizeZ(omt.rint(128))
> p.setSizeC(omt.rint(4))
> p.setSizeT(omt.rint(256))
> do = om.model.DimensionOrderI()
> do.setValue(omt.rstring('XYZCT'))
> pt = om.model.PixelsTypeI()
> pt.setValue(omt.rstring('int16'))
> p.setDimensionOrder(do)
> p.setPixelsType(pt)
> p.setSha1(omt.rstring(''))
> i.addPixels(p)
> sf = c.createSession('root', 'omero')
> u = sf.getUpdateService()
> i = u.saveAndReturnObject(i)
> print i.getId()
> finally:
> c.closeSession()
>
>
More information about the ome-devel
mailing list