User Story #1591 (closed)
Opened 10 years ago
Closed 10 years ago
Add Mask storage to OmeroTables
| Reported by: | jamoore | Owned by: | jamoore |
|---|---|---|---|
| Priority: | major | Milestone: | OMERO-Beta4.x-HCSPreview |
| Component: | Services | Keywords: | n.a. |
| Cc: | bernhard.hollaender@…, cxallan, jburel | Story Points: | n.a. |
| Sprint: | n.a. | Importance: | n.a. |
| Total Remaining Time: | n.a. | Estimated Remaining Time: | n.a. |
Description
Rather than store the masks in the database, support should be added to the preview for storing them in OmeroTables. Note: this is the 3rd potential storage location for masks (Mask.pixels and Mask.bytes are the other two).
Change History (5)
comment:1 Changed 10 years ago by jmoore
comment:2 Changed 10 years ago by jmoore
r5593 includes storage of the byte masks as tables.UInt8Atom arrays in a separate VLArray ("%s_masks" % name). For some reason, Ice is printing "unexpected value" warnings for the byte arrays, but they convert correctly:
In [1]: import omero
In [2]: c = omero.client("localhost")
In [3]: s = c.createSession("root","xxx")
In [4]: r = s.sharedResources()
In [5]: h = r.newTable(1,"/tmp")
...
In [8]: m = omero.grid.MaskColumn("name", "desc", [1], [1], [1], [1.0], [1.0], [1.0], [1.0], [[1,2,3,4,5]])
In [9]: m
Out[9]:
object #0 (::omero::grid::MaskColumn)
{
name = name
description = desc
imageId =
{
[0] = 1
}
theZ =
{
[0] = 1
}
theT =
{
[0] = 1
}
x =
{
[0] = 1.0
}
y =
{
[0] = 1.0
}
w =
{
[0] = 1.0
}
h =
{
[0] = 1.0
}
bytes =
{
[0] =
{
[0] = 1
[1] = 2
[2] = 3
[3] = 4
[4] = 5
}
}
}
In [10]: h.initialize([m])
In [11]: h.addData([m])
In [12]: h.slice(None,None)
Out[12]:
object #0 (::omero::grid::Data)
{
lastModification = 1256571786936
rowNumbers =
{
}
columns =
{
[0] = object #1 (::omero::grid::MaskColumn)
{
name = name
description =
imageId =
{
[0] = 1
}
theZ =
{
[0] = 1
}
theT =
{
[0] = 1
}
x =
{
[0] = 1.0
}
y =
{
[0] = 1.0
}
w =
{
[0] = 1.0
}
h =
{
[0] = 1.0
}
bytes =
{
[0] =
{
[0] = <invalid value - expected byte>
[1] = <invalid value - expected byte>
[2] = <invalid value - expected byte>
[3] = <invalid value - expected byte>
[4] = <invalid value - expected byte>
}
}
}
}
}
In [13]: import numpy
In [14]: rv = h.slice(None,None)
In [17]: import tables
In [19]: rv.columns[0].bytes[0]
Out[19]: '\x01\x02\x03\x04\x05'
In [21]: numpy.fromstring(rv.columns[0].bytes[0], count=len(rv.columns[0].bytes[0]), dtype=tables.UInt8Atom())
)
Out[22]: array([1, 2, 3, 4, 5], dtype=uint8)
comment:3 Changed 10 years ago by jmoore
- Cc jburel added
comment:4 Changed 10 years ago by cxallan
Initial support within the importer for masks in r5620.
comment:5 Changed 10 years ago by jmoore
- Resolution set to fixed
- Status changed from new to closed
Closing with a note to review in #1638
r5591 has the initial MaskColumn type. Next step is to add support for an VLArray which contains the bytes. Whether or not they are always loaded or must be manually loaded remains to be seen.