Skip to content

Commit

Permalink
Add kind to all shapes types (#117)
Browse files Browse the repository at this point in the history
* add kind to all shapes

* add ellipse

* undo skips
  • Loading branch information
tlambert03 authored Dec 29, 2021
1 parent 63b4871 commit 6783281
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/ome_autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,22 @@ def dict(self, **k: Any) -> Dict[str, Any]:
fields='kind: Literal["rectangle"] = "rectangle"',
imports="from typing_extensions import Literal",
),
"Polygon": ClassOverride(
fields='kind: Literal["polygon"] = "polygon"',
imports="from typing_extensions import Literal",
),
"Polyline": ClassOverride(
fields='kind: Literal["polyline"] = "polyline"',
imports="from typing_extensions import Literal",
),
"Line": ClassOverride(
fields='kind: Literal["line"] = "line"',
imports="from typing_extensions import Literal",
),
"Ellipse": ClassOverride(
fields='kind: Literal["ellipse"] = "ellipse"',
imports="from typing_extensions import Literal",
),
}


Expand Down
148 changes: 148 additions & 0 deletions testing/data/shape-union.ome.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2016-06 http://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd">
<Project ID="Project:51" Name="test">
<Description />
<DatasetRef ID="Dataset:52" />
<DatasetRef ID="Dataset:51" />
<AnnotationRef ID="Annotation:25104" />
<AnnotationRef ID="Annotation:25107" />
</Project>
<Dataset ID="Dataset:52" Name="Downloads">
<Description />
<ImageRef ID="Image:51" />
<ImageRef ID="Image:27423" />
<AnnotationRef ID="Annotation:25081" />
<AnnotationRef ID="Annotation:25082" />
<AnnotationRef ID="Annotation:25105" />
</Dataset>
<Dataset ID="Dataset:51" Name="test_ds">
<Description />
<ImageRef ID="Image:52" />
<AnnotationRef ID="Annotation:25106" />
</Dataset>
<Image ID="Image:51" Name="C4_drawing.tif">
<Description />
<Pixels DimensionOrder="XYZCT" ID="Pixels:51" SizeC="1" SizeT="1" SizeX="305" SizeY="240" SizeZ="46" Type="uint8">
<MetadataOnly />
</Pixels>
<ROIRef ID="ROI:101" />
<ROIRef ID="ROI:102" />
<ROIRef ID="ROI:103" />
<ROIRef ID="ROI:104" />
<ROIRef ID="ROI:105" />
<ROIRef ID="ROI:106" />
<ROIRef ID="ROI:107" />
<ROIRef ID="ROI:108" />
<AnnotationRef ID="Annotation:25107" />
<AnnotationRef ID="Annotation:25108" />
</Image>
<Image ID="Image:27423" Name="PXL_20210819_201347847.PANO.jpg">
<Description />
<Pixels DimensionOrder="XYZCT" ID="Pixels:27423" SizeC="3" SizeT="1" SizeX="6400" SizeY="1655" SizeZ="1" Type="uint8">
<MetadataOnly />
</Pixels>
<AnnotationRef ID="Annotation:25102" />
<AnnotationRef ID="Annotation:25103" />
<AnnotationRef ID="Annotation:25107" />
</Image>
<Image ID="Image:52" Name="C4_drawing.tif">
<Description />
<Pixels DimensionOrder="XYZCT" ID="Pixels:52" SizeC="1" SizeT="1" SizeX="305" SizeY="240" SizeZ="46" Type="uint8">
<MetadataOnly />
</Pixels>
<AnnotationRef ID="Annotation:25109" />
</Image>
<StructuredAnnotations>
<MapAnnotation ID="Annotation:25104">
<Value>
<M K="yes">aproj</M>
<M K="also yes">definitely aproj</M>
</Value>
</MapAnnotation>
<TagAnnotation ID="Annotation:25107">
<Value>common</Value>
</TagAnnotation>
<MapAnnotation ID="Annotation:25081">
<Value>
<M K="aasdf">asd</M>
</Value>
</MapAnnotation>
<TagAnnotation ID="Annotation:25108">
<Value>exclusive</Value>
</TagAnnotation>
<MapAnnotation ID="Annotation:25102">
<Value>
<M K="qqqqqqq">ausdjk</M>
</Value>
</MapAnnotation>
<MapAnnotation ID="Annotation:25082">
<Value>
<M K="aasdf">asd</M>
</Value>
</MapAnnotation>
<MapAnnotation ID="Annotation:25105">
<Value>
<M K="dataset?">yup</M>
</Value>
</MapAnnotation>
<MapAnnotation ID="Annotation:25103">
<Value>
<M K="qqqqqqq">ausdjk</M>
</Value>
</MapAnnotation>
<MapAnnotation ID="Annotation:25106">
<Value>
<M K="another dataset?">yuuuup</M>
</Value>
</MapAnnotation>
<MapAnnotation ID="Annotation:25109">
<Value>
<M K="aaaaa">hello</M>
</Value>
</MapAnnotation>
</StructuredAnnotations>
<ROI ID="ROI:101">
<Union>
<Rectangle ID="Shape:101" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="23" Height="42.99999999999989" Width="55.49999999999986" X="57.124999999999844" Y="28.749999999999922" />
</Union>
</ROI>
<ROI ID="ROI:102">
<Union>
<Point ID="Shape:102" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="11" X="159.87499999999957" Y="128.7499999999997" />
</Union>
</ROI>
<ROI ID="ROI:103">
<Union>
<Point ID="Shape:103" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="2" X="227.62499999999937" Y="120.9999999999997" />
</Union>
</ROI>
<ROI ID="ROI:104">
<Union>
<Point ID="Shape:104" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="2" X="163.62499999999955" Y="63.74999999999986" />
</Union>
</ROI>
<ROI ID="ROI:105">
<Union>
<Point ID="Shape:105" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="2" X="90.12499999999976" Y="117.49999999999972" />
</Union>
</ROI>
<ROI ID="ROI:106">
<Union>
<Line ID="Shape:106" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="36" X1="84.12499999999979" X2="214.12499999999943" Y1="51.24999999999989" Y2="155.99999999999963" />
</Union>
</ROI>
<ROI ID="ROI:107">
<Union>
<Polygon ID="Shape:107" FillColor="-256" StrokeColor="-65281" TheT="0" TheZ="45" Points="158.1249999999996,27.749999999999925 71.12499999999983,72.9999999999998 73.12499999999983,151.7499999999996 228.1249999999994,191.4999999999995 213.87499999999946,95.99999999999974 143.87499999999963,102.24999999999973 146.87499999999963,143.7499999999996 180.37499999999955,142.24999999999963" />
</Union>
</ROI>
<ROI ID="ROI:108">
<Union>
<Polygon ID="Shape:108" FillColor="-256" StrokeColor="-65281" Text="this one has a comment" TheT="0" TheZ="0" Points="98.12499999999976,21.999999999999943 56.37499999999987,94.74999999999974 74.37499999999983,175.99999999999952 216.87499999999946,189.7499999999995 263.6249999999994,110.2499999999997 248.87499999999935,35.2499999999999 140.87499999999966,100.99999999999973 178.62499999999955,23.749999999999936" />
</Union>
</ROI>
<ROI ID="ROI:109">
<Union>
<Ellipse ID="Shape:109" X="8.692898522828159" Y="13.194578115007033" RadiusX="83.35868762069157" RadiusY="11.176583815064788"></Ellipse>
</Union>
</ROI>
</OME>
1 change: 0 additions & 1 deletion testing/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# Order of elements in StructuredAnnotations and Union are jumbled.
"timestampannotation-posix-only",
"transformations-downgrade",
"transformations-upgrade",
}
SKIP_ROUNDTRIP = {
# These have XMLAnnotations with extra namespaces and mixed content, which
Expand Down

0 comments on commit 6783281

Please sign in to comment.