@@ -736,9 +736,11 @@ the stored metadata:
736
736
+-----------------------------------+---------------------------------------+
737
737
| odml.DType.url or 'url' | "https://en.wikipedia.org/wiki/Earth" |
738
738
+-----------------------------------+---------------------------------------+
739
+ | odml.DType.tuple | "(39.12; 67.19)" |
740
+ +-----------------------------------+---------------------------------------+
739
741
740
- The available types are implemented in the odml.types Module. Note that the
741
- last three data types, it not defined, cannot be deduced, but are instead
742
+ The available types are implemented in the ' odml.dtypes' Module. Note that the
743
+ last four data types, if not defined, cannot be deduced, but are instead
742
744
always interpreted as string.
743
745
744
746
If we append now our new Property to the previously created sub-Section
@@ -782,6 +784,29 @@ Note that it is also possible to add a metadata entry later on::
782
784
u'Blind Passenger']
783
785
784
786
787
+ The tuple datatype you might have noticed in the dtype table above has to be
788
+ specially handled. It is intended to enforce a specific number of datapoints
789
+ for each value entry. This is useful in case of 2D or 3D data, where all
790
+ datapoints always have to be present for each entry.
791
+ The dtype itself has to contain the number corresponding to the required value
792
+ data points. For the value data points themselves, they have to be enclosed
793
+ by brackets and separated by a semicolon.
794
+
795
+ >>> pixel_prop = odml.Property(name = " pixel map" )
796
+ >>> pixel_prop.dtype = " 2-tuple"
797
+ >>> pixel_prop.value = [" (1; 2)" , " (3; 4)" ]
798
+
799
+ >>> voxel_prop = odml.Property(name = " voxel map" )
800
+ >>> voxel_prop.dtype = " 3-tuple"
801
+ >>> voxel_prop.value = " (1; 2; 3)"
802
+
803
+ Please note, that inconsistent tuple values will raise an error:
804
+
805
+ >>> tprop = odml.Property(name = " tuple fail" )
806
+ >>> tprop.dtype = " 3-tuple"
807
+ >>> tprop.value = [" (1; 2)" ]
808
+
809
+
785
810
Printing XML-representation of an odML file:
786
811
--------------------------------------------
787
812
0 commit comments