Skip to content

Commit

Permalink
Merge pull request ome#1540 from rleigh-dundee/cpp-metadata5
Browse files Browse the repository at this point in the history
C++: Complete OME-XML serialisation to and from OME model objects
  • Loading branch information
joshmoore committed Jan 29, 2015
2 parents e008704 + 9cd0794 commit 74843c7
Show file tree
Hide file tree
Showing 42 changed files with 1,862 additions and 943 deletions.
230 changes: 230 additions & 0 deletions components/specification/samples/2013-06/2013-06-posix-datetests.ome
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<OME:OME xmlns:OME="http://www.openmicroscopy.org/Schemas/OME/2013-06"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ROI="http://www.openmicroscopy.org/Schemas/ROI/2013-06"
xmlns:SA="http://www.openmicroscopy.org/Schemas/SA/2013-06"
xmlns:SPW="http://www.openmicroscopy.org/Schemas/SPW/2013-06"
xmlns:Bin="http://www.openmicroscopy.org/Schemas/BinaryFile/2013-06"
xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2013-06 http://www.openmicroscopy.org/Schemas/OME/2013-06/ome.xsd">

<OME:Project ID="Project:0">
<OME:DatasetRef ID="Dataset:0"/>
<SA:AnnotationRef ID="Annotation:0"/>
</OME:Project>
<OME:Dataset ID="Dataset:0">
<OME:ImageRef ID="Image:0"/>
<SA:AnnotationRef ID="Annotation:1"/>
</OME:Dataset>
<SPW:Plate ID="Plate:0">
<SPW:Description>Plate 0 Description</SPW:Description>
<SPW:Well ID="Well:0" Column="1" Row="1" Color="-2147483648" Type="TheWell0Status">
<SPW:WellSample ID="WellSample:0" Index="1">
<OME:ImageRef ID="Image:0"/>
</SPW:WellSample>
</SPW:Well>
<SA:AnnotationRef ID="Annotation:0"/>
<SPW:PlateAcquisition ID="PlateAcquisition:0">
<SPW:Description>Plate Acquisition 0 Description</SPW:Description>
<SA:AnnotationRef ID="Annotation:1"/>
</SPW:PlateAcquisition>
</SPW:Plate>
<SPW:Plate ID="Plate:1"/>
<SPW:Screen ID="Screen:0" Name="ScreenName0" ProtocolDescription="Protocol Description Test0"
ProtocolIdentifier="ProtocolTest0ID" ReagentSetDescription="Reagents Set XYZ"
ReagentSetIdentifier="ReagentsXYZ-ID" Type="ScreenType0">
<SPW:Description>Screen 0 Description</SPW:Description>
<SPW:Reagent ID="Reagent:0"/>
<SPW:PlateRef ID="Plate:0"/>
<SA:AnnotationRef ID="Annotation:1"/>
</SPW:Screen>

<SPW:Screen ID="Screen:1" Name="ScreenName1" ProtocolDescription="Protocol Description Test1"
ProtocolIdentifier="ProtocolTest1ID" ReagentSetDescription="Reagents Set PQR"
ReagentSetIdentifier="ReagentsPQR-ID" Type="ScreenType1">
<SPW:Description>Screen 1 Description</SPW:Description>
<SPW:Reagent ID="Reagent:1"/>
<SPW:PlateRef ID="Plate:1"/>
<SPW:PlateRef ID="Plate:0"/>
<SA:AnnotationRef ID="Annotation:1"/>
</SPW:Screen>

<SPW:Screen ID="Screen:2" Name="ScreenName2" ProtocolDescription="Protocol Description Test2"
ProtocolIdentifier="ProtocolTest2ID" ReagentSetDescription="Reagents Set IJK"
ReagentSetIdentifier="ReagentsIJK-ID" Type="ScreenType2">
<SPW:Description>Screen 2 Description</SPW:Description>
<SPW:Reagent ID="Reagent:2"/>
<SA:AnnotationRef ID="Annotation:1"/>
</SPW:Screen>

<SPW:Screen ID="Screen:3" Name="ScreenName3" ProtocolDescription="Protocol Description Test3"
ProtocolIdentifier="ProtocolTest3ID" ReagentSetDescription="Reagents Set AJP"
ReagentSetIdentifier="ReagentsAJP-ID" Type="ScreenType3">
<SPW:Description>Screen 3 Description</SPW:Description>
<SPW:Reagent ID="Reagent:3"/>
<SPW:PlateRef ID="Plate:0"/>
<SA:AnnotationRef ID="Annotation:1"/>
</SPW:Screen>

<OME:Experimenter ID="Experimenter:0"/>
<OME:Experimenter ID="Experimenter:1" FirstName="John" MiddleName="Andrew" LastName="Smith"
Email="[email protected]"> </OME:Experimenter>
<OME:Experimenter ID="Experimenter:2"/>
<OME:Experimenter ID="Experimenter:3"/>
<OME:Experimenter ID="Experimenter:4"/>
<OME:Experimenter ID="Experimenter:5"/>
<OME:Experimenter ID="Experimenter:6"/>

<OME:ExperimenterGroup Name="MyGroup - Leader+Contact match" ID="ExperimenterGroup:Group:0">
<Description xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06">A description for my group 0. Complete with basic formatting, like new
lines.</Description>
<OME:ExperimenterRef ID="Experimenter:5"/>
<Leader xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" ID="Experimenter:0"/>
</OME:ExperimenterGroup>

<OME:ExperimenterGroup Name="MyOtherGroup" ID="ExperimenterGroup:Group:1">
<Description xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06">A description for my group 1. Complete with basic formatting, like new
lines.</Description>
<OME:ExperimenterRef ID="Experimenter:2"/>
<OME:ExperimenterRef ID="Experimenter:3"/>
<Leader xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" ID="Experimenter:0"/>
<OME:Leader ID="Experimenter:1"/>
</OME:ExperimenterGroup>

<OME:ExperimenterGroup Name="NoMatch" ID="ExperimenterGroup:Group:2">
<Description xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06">A description for my group 2. Complete with basic formatting, like new
lines.</Description>
<OME:ExperimenterRef ID="Experimenter:4"/>
<Leader xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" ID="Experimenter:6"/>
</OME:ExperimenterGroup>

<OME:ExperimenterGroup Name="LeaderMatch" ID="ExperimenterGroup:Group:3">
<Description xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06">A description for my group 3. Complete with basic formatting, like new
lines.</Description>
<Leader xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" ID="Experimenter:0"/>
</OME:ExperimenterGroup>
<OME:ExperimenterGroup Name="ContactMatch" ID="ExperimenterGroup:Group:4">
<Description xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06">A description for my group 4. Complete with basic formatting, like new
lines.</Description>
<OME:Leader ID="Experimenter:0"/>
</OME:ExperimenterGroup>

<Instrument xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" ID="Instrument:0">
<Objective ID="Objective:0" LotNumber="123" Manufacturer="OME-Labs"
NominalMagnification="20" CalibratedMagnification="20.34"/>
</Instrument>
<OME:Image ID="Image:0" Name="6x6x1x8-swatch.tif">
<OME:AcquisitionDate>2012-03-05T02:48:38</OME:AcquisitionDate>
<ExperimenterRef xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06"
ID="Experimenter:1"/>
<Pixels xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06" DimensionOrder="XYCZT"
ID="Pixels:0:0" PhysicalSizeX="10000.0" PhysicalSizeY="10000.0" Type="uint8" SizeC="3"
SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
<Channel AcquisitionMode="LaserScanningConfocalMicroscopy" Color="-1147483648"
ID="Channel:0"> </Channel>
<Channel AcquisitionMode="LaserScanningConfocalMicroscopy" Color="-1474836488"
ID="Channel:1"> </Channel>
<Channel AcquisitionMode="MultiPhotonMicroscopy" Color="-2144364811" ID="Channel:2"> </Channel>
<Bin:BinData BigEndian="false" Length="32"
>/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</Bin:BinData>
<Bin:BinData BigEndian="false" Length="32"
>AP+rzuv/AAB5n8Pi/wBHbJO3//8dPGCF</Bin:BinData>
<Bin:BinData BigEndian="false" Length="32"
>//+szuv/AP95n8PiAABHbZO3AP8dPF+G</Bin:BinData>
</Pixels>
<ROI:ROIRef ID="ROI:0"/>
<ROI:ROIRef ID="ROI:1"/>
<ROI:ROIRef ID="ROI:2"/>
</OME:Image>
<SA:StructuredAnnotations>
<SA:XMLAnnotation ID="Annotation:0">
<SA:Value>
<test1 xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06"/>
</SA:Value>
</SA:XMLAnnotation>
<SA:XMLAnnotation ID="Annotation:1">
<SA:Value>
<test2 xmlns="http://www.openmicroscopy.org/Schemas/OME/2013-06"/>
</SA:Value>
</SA:XMLAnnotation>
<!-- A range of dates, valid in the schema designed to test/stretch/break the model API; includes only valid POSIX timestamps. -->
<SA:TimestampAnnotation ID="Annotation:2"
Namespace="sample.openmicroscopy.org/time/retirement">
<SA:Value>2037-12-15T17:30:00</SA:Value>
</SA:TimestampAnnotation>
<SA:TimestampAnnotation ID="Annotation:3"
Namespace="sample.openmicroscopy.org/time/post1972">
<SA:Value>1996-03-23T14:45:00</SA:Value>
</SA:TimestampAnnotation>
<SA:TimestampAnnotation ID="Annotation:4"
Namespace="sample.openmicroscopy.org/time/1970-1972">
<SA:Value>1971-05-06T18:34:59</SA:Value>
</SA:TimestampAnnotation>
</SA:StructuredAnnotations>
<ROI:ROI ID="ROI:0">
<ROI:Union>
<ROI:Shape ID="Shape:0" TheC="0">
<ROI:Point X="1" Y="1"/>
</ROI:Shape>
</ROI:Union>
</ROI:ROI>
<ROI:ROI ID="ROI:1">
<ROI:Union>
<ROI:Shape ID="Shape:1" FillRule="NonZero" FontFamily="sans-serif" FontSize="1"
FontStyle="Bold" LineCap="Butt" StrokeDashArray="1" StrokeWidth="1" TheC="2"
FillColor="1" StrokeColor="1" Text="Hello">
<ROI:Point X="1" Y="1"/>
</ROI:Shape>
</ROI:Union>
<ROI:Description>ROI 1 Upgradable description.</ROI:Description>
</ROI:ROI>
<ROI:ROI ID="ROI:2">
<ROI:Union>
<ROI:Shape ID="Shape:2" FillRule="EvenOdd" Text="Hi There! (from shape 2)">
<ROI:Rectangle X="1" Y="2" Width="3" Height="4"/>
<ROI:Transform A00="10" A10="20" A01="30" A11="40" A02="50" A12="60"/>
</ROI:Shape>
<ROI:Shape ID="Shape:3" FillRule="EvenOdd" FontStyle="Normal" FontFamily="serif"
Text="Hello World Text Value!(from shape 3)">
<ROI:Label X="1" Y="1"/>
</ROI:Shape>
<ROI:Shape ID="Shape:4" StrokeWidth="2" StrokeColor="15">
<ROI:Polygon Points="1,1 10,20, 20,20 20,10"/>
</ROI:Shape>
<ROI:Shape ID="Shape:5" StrokeWidth="2" StrokeColor="16">
<ROI:Polyline Points="15,15 15,25, 25,25 25,15" MarkerStart="Arrow"
MarkerEnd="Arrow"/>
</ROI:Shape>
<ROI:Shape ID="Shape:6" StrokeWidth="2" StrokeColor="161">
<ROI:Polyline Points="1.1,1.1 10.1,20.1, 20.1,20.1 20.1,10.1" MarkerStart="Circle"/>
</ROI:Shape>
<ROI:Shape ID="Shape:7" StrokeWidth="2" StrokeColor="17">
<ROI:Line X1="1.7" Y1="2.7" X2="3.7" Y2="4.7" MarkerStart="Square"
MarkerEnd="Circle"/>
</ROI:Shape>
<ROI:Shape ID="Shape:8" StrokeWidth="2" StrokeColor="171">
<ROI:Line X1="1.71" Y1="2.71" X2="3.71" Y2="4.71" MarkerEnd="Circle"/>
</ROI:Shape>
<ROI:Shape ID="Shape:9" StrokeWidth="2" StrokeColor="172">
<ROI:Line X1="1.72" Y1="2.72" X2="3.72" Y2="4.72" MarkerEnd="Circle"/>
</ROI:Shape>

</ROI:Union>
</ROI:ROI>
<ROI:ROI ID="ROI:3">
<ROI:Union>
<ROI:Shape ID="Shape:11" Visible="false" Text="Removed Path">
<ROI:Label X="0" Y="0"/>
</ROI:Shape>
</ROI:Union>
</ROI:ROI>
<ROI:ROI ID="ROI:4">
<ROI:Union>
<ROI:Shape ID="Shape:12" Visible="false" Text="Removed Path">
<ROI:Label X="0" Y="0"/>
</ROI:Shape>
<ROI:Shape ID="Shape:13" Visible="false" Text="Removed Path">
<ROI:Label X="0" Y="0"/>
</ROI:Shape>
</ROI:Union>
</ROI:ROI>
</OME:OME>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<SA:XMLAnnotation ID="Annotation:1" Namespace="openmicroscopy.org/sample/body/multivalue">
<SA:Value>
<valueA>A</valueA>
<valueB>B</valueB>
<valueB xmlns="http://example.com/xmlschema/">B<nestedA><nestedB/></nestedA></valueB>
</SA:Value>
</SA:XMLAnnotation>
</SA:StructuredAnnotations>
Expand Down
44 changes: 26 additions & 18 deletions components/xsd-fu/python/ome/modeltools/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ def _get_baseObjectProperties(self):
_get_baseObjectProperties,
doc="""The model object's base object properties.""")

def _get_refNodeName(self):
if self.base == "Reference":
return self.properties["ID"].langType
return None
refNodeName = property(
_get_refNodeName,
doc="""The name of this node's reference node; None otherwise.""")

def _get_langType(self):
return self.name
langType = property(_get_langType, doc="""The model object's type.""")
Expand Down Expand Up @@ -342,26 +334,42 @@ def _get_parents(self):
parents = property(
_get_parents, doc="""The parents for this object.""")

def _get_parentName(self):
def _get_parent(self):
parents = self.model.resolve_parents(self.name)

name = self.modelBaseType
parent = None

if parents is not None:
parent = self.model.getObjectByName(parents.keys()[0])
if (parent is not None and parent.isAbstractProprietary and
self.name not in config.ANNOTATION_OVERRIDE):
name = parent.name

return parent

def _get_parentName(self):
parent = self._get_parent()
name = self.modelBaseType

if (parent is not None and parent.isAbstractProprietary and
self.name not in config.ANNOTATION_OVERRIDE):
name = parent.name

return name
parentName = property(
_get_parentName, doc="""The parent class name for this object.""")

def isComplex(self):
"""
Returns whether or not the model object has a "complex" content type.
"""
return self.element.isComplex()
def _get_isParentAbstractProprietary(self):
parent = self._get_parent()

abstract = False

if (parent is not None and parent.isAbstractProprietary and
self.name not in config.ANNOTATION_OVERRIDE):
abstract = True

return abstract
isParentAbstractProprietary = property(
_get_isParentAbstractProprietary,
doc="""Returns whether or not the model object has an abstract"""
""" proprietary parent.""")

def __str__(self):
return self.__repr__()
Expand Down
Loading

0 comments on commit 74843c7

Please sign in to comment.