Skip to main content

ome_metadata/
ome.rs

1#![allow(clippy::too_many_arguments)]
2use crate::error::Error;
3#[cfg(feature = "python")]
4use crate::py::PyDisplay;
5use ome_metadata_derive::OmeXML;
6#[cfg(feature = "python")]
7use ome_metadata_derive::{PyOme, PyOmeComplexEnum, PyOmeEnum, PyOmeUnit};
8#[cfg(feature = "python")]
9use pyo3::IntoPyObjectExt;
10#[cfg(feature = "python")]
11use pyo3::prelude::*;
12use quick_xml::de::from_str;
13use quick_xml::se::to_string;
14use serde::{Deserialize, Serialize};
15use std::cmp::PartialEq;
16use strum::{AsRefStr, EnumString, VariantNames};
17
18#[cfg_attr(
19    feature = "python",
20    pyclass(
21        module = "ome_metadata",
22        skip_from_py_object,
23        get_all,
24        set_all,
25        eq,
26        new = "from_fields"
27    ),
28    derive(FromPyObject, PyOme)
29)]
30#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
31pub struct AffineTransform {
32    #[serde(rename = "@A00")]
33    pub a00: f32,
34    #[serde(rename = "@A10")]
35    pub a10: f32,
36    #[serde(rename = "@A01")]
37    pub a01: f32,
38    #[serde(rename = "@A11")]
39    pub a11: f32,
40    #[serde(rename = "@A02")]
41    pub a02: f32,
42    #[serde(rename = "@A12")]
43    pub a12: f32,
44}
45#[cfg_attr(
46    feature = "python",
47    pyclass(
48        module = "ome_metadata",
49        skip_from_py_object,
50        get_all,
51        set_all,
52        eq,
53        new = "from_fields"
54    ),
55    derive(FromPyObject, PyOme)
56)]
57#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
58pub struct Annotation {
59    #[serde(rename = "@ID")]
60    pub id: String,
61    #[serde(
62        default,
63        rename = "@Namespace",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub namespace: Option<String>,
67    #[serde(
68        default,
69        rename = "@Annotator",
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub annotator: Option<String>,
73    #[serde(
74        default,
75        rename = "Description",
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub description: Option<String>,
79    #[serde(
80        default,
81        rename = "AnnotationRef",
82        skip_serializing_if = "Vec::is_empty"
83    )]
84    pub annotation_ref: Vec<AnnotationRef>,
85}
86#[cfg_attr(
87    feature = "python",
88    pyclass(
89        module = "ome_metadata",
90        skip_from_py_object,
91        get_all,
92        set_all,
93        eq,
94        new = "from_fields"
95    ),
96    derive(FromPyObject, PyOme)
97)]
98#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq, OmeXML)]
99pub struct AnnotationRef {
100    #[serde(rename = "@ID")]
101    pub id: String,
102}
103#[cfg_attr(
104    feature = "python",
105    pyclass(
106        module = "ome_metadata",
107        skip_from_py_object,
108        get_all,
109        set_all,
110        eq,
111        new = "from_fields"
112    ),
113    derive(FromPyObject, PyOme)
114)]
115#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
116pub struct Arc {
117    #[serde(
118        default,
119        rename = "@Manufacturer",
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub manufacturer: Option<String>,
123    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
124    pub model: Option<String>,
125    #[serde(
126        default,
127        rename = "@SerialNumber",
128        skip_serializing_if = "Option::is_none"
129    )]
130    pub serial_number: Option<String>,
131    #[serde(
132        default,
133        rename = "@LotNumber",
134        skip_serializing_if = "Option::is_none"
135    )]
136    pub lot_number: Option<String>,
137    #[serde(rename = "@ID")]
138    pub id: String,
139    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
140    pub power: Option<f32>,
141    #[serde(default = "Arc::default_power_unit", rename = "@PowerUnit")]
142    pub power_unit: UnitsPower,
143    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
144    pub r#type: Option<ArcType>,
145    #[serde(
146        default,
147        rename = "AnnotationRef",
148        skip_serializing_if = "Vec::is_empty"
149    )]
150    pub annotation_ref: Vec<AnnotationRef>,
151}
152impl Arc {
153    pub fn default_power_unit() -> UnitsPower {
154        UnitsPower::W
155    }
156}
157impl Default for Arc {
158    fn default() -> Self {
159        Self {
160            manufacturer: None,
161            model: None,
162            serial_number: None,
163            lot_number: None,
164            id: String::new(),
165            power: None,
166            power_unit: Self::default_power_unit(),
167            r#type: None,
168            annotation_ref: Vec::new(),
169        }
170    }
171}
172#[derive(
173    EnumString,
174    AsRefStr,
175    Debug,
176    strum::Display,
177    Clone,
178    Copy,
179    PartialEq,
180    Eq,
181    PartialOrd,
182    Ord,
183    Hash,
184    Deserialize,
185    Serialize,
186    VariantNames,
187    OmeXML,
188)]
189#[strum(ascii_case_insensitive)]
190#[cfg_attr(
191    feature = "python",
192    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
193    derive(PyOmeEnum)
194)]
195pub enum ArcType {
196    #[serde(rename = "Hg")]
197    Hg,
198    #[serde(rename = "Xe")]
199    Xe,
200    #[serde(rename = "HgXe")]
201    HgXe,
202    #[serde(rename = "Other")]
203    Other,
204}
205#[cfg_attr(
206    feature = "python",
207    pyclass(
208        module = "ome_metadata",
209        skip_from_py_object,
210        get_all,
211        set_all,
212        eq,
213        new = "from_fields"
214    ),
215    derive(FromPyObject, PyOme)
216)]
217#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
218pub struct BinData {
219    #[serde(default = "BinData::default_compression", rename = "@Compression")]
220    pub compression: BinDataCompressionType,
221    #[serde(rename = "@BigEndian")]
222    pub big_endian: bool,
223    #[serde(rename = "@Length")]
224    pub length: i64,
225    #[serde(rename = "$text")]
226    pub content: String,
227}
228impl BinData {
229    pub fn default_compression() -> BinDataCompressionType {
230        BinDataCompressionType::None
231    }
232}
233#[derive(
234    EnumString,
235    AsRefStr,
236    Debug,
237    strum::Display,
238    Clone,
239    Copy,
240    PartialEq,
241    Eq,
242    PartialOrd,
243    Ord,
244    Hash,
245    Deserialize,
246    Serialize,
247    VariantNames,
248    OmeXML,
249)]
250#[strum(ascii_case_insensitive)]
251#[cfg_attr(
252    feature = "python",
253    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
254    derive(PyOmeEnum)
255)]
256pub enum BinDataCompressionType {
257    #[serde(rename = "zlib")]
258    Zlib,
259    #[serde(rename = "bzip2")]
260    Bzip2,
261    #[serde(rename = "none")]
262    None,
263}
264#[cfg_attr(
265    feature = "python",
266    pyclass(
267        module = "ome_metadata",
268        skip_from_py_object,
269        get_all,
270        set_all,
271        eq,
272        new = "from_fields"
273    ),
274    derive(FromPyObject, PyOme)
275)]
276#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
277pub struct BinaryFile {
278    #[serde(rename = "@FileName")]
279    pub file_name: String,
280    #[serde(rename = "@Size")]
281    pub size: i64,
282    #[serde(default, rename = "@MIMEType", skip_serializing_if = "Option::is_none")]
283    pub mime_type: Option<String>,
284    #[serde(rename = "$value")]
285    pub content: BinaryFileContent,
286}
287#[derive(
288    AsRefStr, Debug, strum::Display, Clone, Deserialize, Serialize, VariantNames, PartialEq, OmeXML,
289)]
290#[strum(ascii_case_insensitive)]
291#[cfg_attr(
292    feature = "python",
293    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
294    derive(PyOmeComplexEnum)
295)]
296pub enum BinaryFileContent {
297    #[serde(rename = "External")]
298    External(External),
299    #[serde(rename = "BinData")]
300    BinData(BinData),
301}
302#[derive(
303    EnumString,
304    AsRefStr,
305    Debug,
306    strum::Display,
307    Clone,
308    Copy,
309    PartialEq,
310    Eq,
311    PartialOrd,
312    Ord,
313    Hash,
314    Deserialize,
315    Serialize,
316    VariantNames,
317    OmeXML,
318)]
319#[strum(ascii_case_insensitive)]
320#[cfg_attr(
321    feature = "python",
322    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
323    derive(PyOmeEnum)
324)]
325pub enum BinningType {
326    #[strum(serialize = "1x1")]
327    #[serde(rename = "1x1")]
328    _1X1,
329    #[strum(serialize = "2x2")]
330    #[serde(rename = "2x2")]
331    _2X2,
332    #[strum(serialize = "4x4")]
333    #[serde(rename = "4x4")]
334    _4X4,
335    #[strum(serialize = "8x8")]
336    #[serde(rename = "8x8")]
337    _8X8,
338    #[serde(rename = "Other")]
339    Other,
340}
341#[cfg_attr(
342    feature = "python",
343    pyclass(
344        module = "ome_metadata",
345        skip_from_py_object,
346        get_all,
347        set_all,
348        eq,
349        new = "from_fields"
350    ),
351    derive(FromPyObject, PyOme)
352)]
353#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
354pub struct BooleanAnnotation {
355    #[serde(rename = "@ID")]
356    pub id: String,
357    #[serde(
358        default,
359        rename = "@Namespace",
360        skip_serializing_if = "Option::is_none"
361    )]
362    pub namespace: Option<String>,
363    #[serde(
364        default,
365        rename = "@Annotator",
366        skip_serializing_if = "Option::is_none"
367    )]
368    pub annotator: Option<String>,
369    #[serde(
370        default,
371        rename = "Description",
372        skip_serializing_if = "Option::is_none"
373    )]
374    pub description: Option<String>,
375    #[serde(
376        default,
377        rename = "AnnotationRef",
378        skip_serializing_if = "Vec::is_empty"
379    )]
380    pub annotation_ref: Vec<AnnotationRef>,
381    #[serde(rename = "Value")]
382    pub value: bool,
383}
384#[cfg_attr(
385    feature = "python",
386    pyclass(
387        module = "ome_metadata",
388        skip_from_py_object,
389        get_all,
390        set_all,
391        eq,
392        new = "from_fields"
393    ),
394    derive(FromPyObject, PyOme)
395)]
396#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
397pub struct Channel {
398    #[serde(rename = "@ID")]
399    pub id: String,
400    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
401    pub name: Option<String>,
402    #[serde(
403        default,
404        rename = "@SamplesPerPixel",
405        skip_serializing_if = "Option::is_none"
406    )]
407    pub samples_per_pixel: Option<i32>,
408    #[serde(
409        default,
410        rename = "@IlluminationType",
411        skip_serializing_if = "Option::is_none"
412    )]
413    pub illumination_type: Option<ChannelIlluminationType>,
414    #[serde(
415        default,
416        rename = "@PinholeSize",
417        skip_serializing_if = "Option::is_none"
418    )]
419    pub pinhole_size: Option<f32>,
420    #[serde(
421        default = "Channel::default_pinhole_size_unit",
422        rename = "@PinholeSizeUnit"
423    )]
424    pub pinhole_size_unit: UnitsLength,
425    #[serde(
426        default,
427        rename = "@AcquisitionMode",
428        skip_serializing_if = "Option::is_none"
429    )]
430    pub acquisition_mode: Option<ChannelAcquisitionModeType>,
431    #[serde(
432        default,
433        rename = "@ContrastMethod",
434        skip_serializing_if = "Option::is_none"
435    )]
436    pub contrast_method: Option<ChannelContrastMethodType>,
437    #[serde(
438        default,
439        rename = "@ExcitationWavelength",
440        skip_serializing_if = "Option::is_none"
441    )]
442    pub excitation_wavelength: Option<f32>,
443    #[serde(
444        default = "Channel::default_excitation_wavelength_unit",
445        rename = "@ExcitationWavelengthUnit"
446    )]
447    pub excitation_wavelength_unit: UnitsLength,
448    #[serde(
449        default,
450        rename = "@EmissionWavelength",
451        skip_serializing_if = "Option::is_none"
452    )]
453    pub emission_wavelength: Option<f32>,
454    #[serde(
455        default = "Channel::default_emission_wavelength_unit",
456        rename = "@EmissionWavelengthUnit"
457    )]
458    pub emission_wavelength_unit: UnitsLength,
459    #[serde(default, rename = "@Fluor", skip_serializing_if = "Option::is_none")]
460    pub fluor: Option<String>,
461    #[serde(default, rename = "@NDFilter", skip_serializing_if = "Option::is_none")]
462    pub nd_filter: Option<f32>,
463    #[serde(
464        default,
465        rename = "@PockelCellSetting",
466        skip_serializing_if = "Option::is_none"
467    )]
468    pub pockel_cell_setting: Option<i32>,
469    #[serde(default = "Channel::default_color", rename = "@Color")]
470    pub color: i32,
471    #[serde(
472        default,
473        rename = "LightSourceSettings",
474        skip_serializing_if = "Option::is_none"
475    )]
476    pub light_source_settings: Option<LightSourceSettings>,
477    #[serde(
478        default,
479        rename = "DetectorSettings",
480        skip_serializing_if = "Option::is_none"
481    )]
482    pub detector_settings: Option<DetectorSettings>,
483    #[serde(
484        default,
485        rename = "FilterSetRef",
486        skip_serializing_if = "Option::is_none"
487    )]
488    pub filter_set_ref: Option<AnnotationRef>,
489    #[serde(
490        default,
491        rename = "AnnotationRef",
492        skip_serializing_if = "Vec::is_empty"
493    )]
494    pub annotation_ref: Vec<AnnotationRef>,
495    #[serde(default, rename = "LightPath", skip_serializing_if = "Option::is_none")]
496    pub light_path: Option<LightPath>,
497}
498impl Channel {
499    pub fn default_pinhole_size_unit() -> UnitsLength {
500        UnitsLength::um
501    }
502    pub fn default_color() -> i32 {
503        0
504    }
505    pub fn default_excitation_wavelength_unit() -> UnitsLength {
506        UnitsLength::nm
507    }
508    pub fn default_emission_wavelength_unit() -> UnitsLength {
509        UnitsLength::nm
510    }
511}
512impl Default for Channel {
513    fn default() -> Self {
514        Self {
515            id: String::new(),
516            name: None,
517            samples_per_pixel: None,
518            illumination_type: None,
519            pinhole_size: None,
520            pinhole_size_unit: Self::default_pinhole_size_unit(),
521            acquisition_mode: None,
522            contrast_method: None,
523            excitation_wavelength: None,
524            excitation_wavelength_unit: Self::default_excitation_wavelength_unit(),
525            emission_wavelength: None,
526            emission_wavelength_unit: Self::default_emission_wavelength_unit(),
527            fluor: None,
528            nd_filter: None,
529            pockel_cell_setting: None,
530            color: Self::default_color(),
531            light_source_settings: None,
532            detector_settings: None,
533            filter_set_ref: None,
534            annotation_ref: Vec::new(),
535            light_path: None,
536        }
537    }
538}
539#[derive(
540    EnumString,
541    AsRefStr,
542    Debug,
543    strum::Display,
544    Clone,
545    Copy,
546    PartialEq,
547    Eq,
548    PartialOrd,
549    Ord,
550    Hash,
551    Deserialize,
552    Serialize,
553    VariantNames,
554    OmeXML,
555)]
556#[strum(ascii_case_insensitive)]
557#[cfg_attr(
558    feature = "python",
559    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
560    derive(PyOmeEnum)
561)]
562pub enum ChannelAcquisitionModeType {
563    #[serde(rename = "WideField")]
564    WideField,
565    #[serde(rename = "LaserScanningConfocalMicroscopy")]
566    LaserScanningConfocalMicroscopy,
567    #[serde(rename = "SpinningDiskConfocal")]
568    SpinningDiskConfocal,
569    #[serde(rename = "SlitScanConfocal")]
570    SlitScanConfocal,
571    #[serde(rename = "MultiPhotonMicroscopy")]
572    MultiPhotonMicroscopy,
573    #[serde(rename = "StructuredIllumination")]
574    StructuredIllumination,
575    #[serde(rename = "SingleMoleculeImaging")]
576    SingleMoleculeImaging,
577    #[serde(rename = "TotalInternalReflection")]
578    TotalInternalReflection,
579    #[serde(rename = "FluorescenceLifetime")]
580    FluorescenceLifetime,
581    #[serde(rename = "SpectralImaging")]
582    SpectralImaging,
583    #[serde(rename = "FluorescenceCorrelationSpectroscopy")]
584    FluorescenceCorrelationSpectroscopy,
585    #[serde(rename = "NearFieldScanningOpticalMicroscopy")]
586    NearFieldScanningOpticalMicroscopy,
587    #[serde(rename = "SecondHarmonicGenerationImaging")]
588    SecondHarmonicGenerationImaging,
589    #[serde(rename = "PALM")]
590    Palm,
591    #[serde(rename = "STORM")]
592    Storm,
593    #[serde(rename = "STED")]
594    Sted,
595    #[serde(rename = "TIRF")]
596    Tirf,
597    #[serde(rename = "FSM")]
598    Fsm,
599    #[serde(rename = "LCM")]
600    Lcm,
601    #[serde(rename = "Other")]
602    Other,
603    #[serde(rename = "BrightField")]
604    BrightField,
605    #[serde(rename = "SweptFieldConfocal")]
606    SweptFieldConfocal,
607    #[serde(rename = "SPIM")]
608    Spim,
609}
610#[derive(
611    EnumString,
612    AsRefStr,
613    Debug,
614    strum::Display,
615    Clone,
616    Copy,
617    PartialEq,
618    Eq,
619    PartialOrd,
620    Ord,
621    Hash,
622    Deserialize,
623    Serialize,
624    VariantNames,
625    OmeXML,
626)]
627#[strum(ascii_case_insensitive)]
628#[cfg_attr(
629    feature = "python",
630    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
631    derive(PyOmeEnum)
632)]
633pub enum ChannelContrastMethodType {
634    #[serde(rename = "Brightfield")]
635    Brightfield,
636    #[serde(rename = "Phase")]
637    Phase,
638    #[serde(rename = "DIC")]
639    Dic,
640    #[serde(rename = "HoffmanModulation")]
641    HoffmanModulation,
642    #[serde(rename = "ObliqueIllumination")]
643    ObliqueIllumination,
644    #[serde(rename = "PolarizedLight")]
645    PolarizedLight,
646    #[serde(rename = "Darkfield")]
647    Darkfield,
648    #[serde(rename = "Fluorescence")]
649    Fluorescence,
650    #[serde(rename = "Other")]
651    Other,
652}
653#[derive(
654    EnumString,
655    AsRefStr,
656    Debug,
657    strum::Display,
658    Clone,
659    Copy,
660    PartialEq,
661    Eq,
662    PartialOrd,
663    Ord,
664    Hash,
665    Deserialize,
666    Serialize,
667    VariantNames,
668    OmeXML,
669)]
670#[strum(ascii_case_insensitive)]
671#[cfg_attr(
672    feature = "python",
673    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
674    derive(PyOmeEnum)
675)]
676pub enum ChannelIlluminationType {
677    #[serde(rename = "Transmitted")]
678    Transmitted,
679    #[serde(rename = "Epifluorescence")]
680    Epifluorescence,
681    #[serde(rename = "Oblique")]
682    Oblique,
683    #[serde(rename = "NonLinear")]
684    NonLinear,
685    #[serde(rename = "Other")]
686    Other,
687}
688#[cfg_attr(
689    feature = "python",
690    pyclass(
691        module = "ome_metadata",
692        skip_from_py_object,
693        get_all,
694        set_all,
695        eq,
696        new = "from_fields"
697    ),
698    derive(FromPyObject, PyOme)
699)]
700#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
701pub struct CommentAnnotation {
702    #[serde(rename = "@ID")]
703    pub id: String,
704    #[serde(
705        default,
706        rename = "@Namespace",
707        skip_serializing_if = "Option::is_none"
708    )]
709    pub namespace: Option<String>,
710    #[serde(
711        default,
712        rename = "@Annotator",
713        skip_serializing_if = "Option::is_none"
714    )]
715    pub annotator: Option<String>,
716    #[serde(
717        default,
718        rename = "Description",
719        skip_serializing_if = "Option::is_none"
720    )]
721    pub description: Option<String>,
722    #[serde(
723        default,
724        rename = "AnnotationRef",
725        skip_serializing_if = "Vec::is_empty"
726    )]
727    pub annotation_ref: Vec<AnnotationRef>,
728    #[serde(rename = "Value")]
729    pub value: String,
730}
731#[cfg_attr(
732    feature = "python",
733    pyclass(
734        module = "ome_metadata",
735        skip_from_py_object,
736        get_all,
737        set_all,
738        eq,
739        new = "from_fields"
740    ),
741    derive(FromPyObject, PyOme)
742)]
743#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
744pub struct Dataset {
745    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
746    pub name: Option<String>,
747    #[serde(rename = "@ID")]
748    pub id: String,
749    #[serde(
750        default,
751        rename = "Description",
752        skip_serializing_if = "Option::is_none"
753    )]
754    pub description: Option<String>,
755    #[serde(
756        default,
757        rename = "ExperimenterRef",
758        skip_serializing_if = "Option::is_none"
759    )]
760    pub experimenter_ref: Option<AnnotationRef>,
761    #[serde(
762        default,
763        rename = "ExperimenterGroupRef",
764        skip_serializing_if = "Option::is_none"
765    )]
766    pub experimenter_group_ref: Option<AnnotationRef>,
767    #[serde(default, rename = "ImageRef", skip_serializing_if = "Vec::is_empty")]
768    pub image_ref: Vec<AnnotationRef>,
769    #[serde(
770        default,
771        rename = "AnnotationRef",
772        skip_serializing_if = "Vec::is_empty"
773    )]
774    pub annotation_ref: Vec<AnnotationRef>,
775}
776#[cfg_attr(
777    feature = "python",
778    pyclass(
779        module = "ome_metadata",
780        skip_from_py_object,
781        get_all,
782        set_all,
783        eq,
784        new = "from_fields"
785    ),
786    derive(FromPyObject, PyOme)
787)]
788#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
789pub struct Detector {
790    #[serde(
791        default,
792        rename = "@Manufacturer",
793        skip_serializing_if = "Option::is_none"
794    )]
795    pub manufacturer: Option<String>,
796    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
797    pub model: Option<String>,
798    #[serde(
799        default,
800        rename = "@SerialNumber",
801        skip_serializing_if = "Option::is_none"
802    )]
803    pub serial_number: Option<String>,
804    #[serde(
805        default,
806        rename = "@LotNumber",
807        skip_serializing_if = "Option::is_none"
808    )]
809    pub lot_number: Option<String>,
810    #[serde(default, rename = "@Gain", skip_serializing_if = "Option::is_none")]
811    pub gain: Option<f32>,
812    #[serde(default, rename = "@Voltage", skip_serializing_if = "Option::is_none")]
813    pub voltage: Option<f32>,
814    #[serde(default = "Detector::default_voltage_unit", rename = "@VoltageUnit")]
815    pub voltage_unit: UnitsElectricPotential,
816    #[serde(default, rename = "@Offset", skip_serializing_if = "Option::is_none")]
817    pub offset: Option<f32>,
818    #[serde(default, rename = "@Zoom", skip_serializing_if = "Option::is_none")]
819    pub zoom: Option<f32>,
820    #[serde(
821        default,
822        rename = "@AmplificationGain",
823        skip_serializing_if = "Option::is_none"
824    )]
825    pub amplification_gain: Option<f32>,
826    #[serde(rename = "@ID")]
827    pub id: String,
828    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
829    pub r#type: Option<DetectorType>,
830    #[serde(
831        default,
832        rename = "AnnotationRef",
833        skip_serializing_if = "Vec::is_empty"
834    )]
835    pub annotation_ref: Vec<AnnotationRef>,
836}
837impl Detector {
838    pub fn default_voltage_unit() -> UnitsElectricPotential {
839        UnitsElectricPotential::V
840    }
841}
842impl Default for Detector {
843    fn default() -> Self {
844        Self {
845            manufacturer: None,
846            model: None,
847            serial_number: None,
848            lot_number: None,
849            gain: None,
850            voltage: None,
851            voltage_unit: Self::default_voltage_unit(),
852            offset: None,
853            zoom: None,
854            amplification_gain: None,
855            id: String::new(),
856            r#type: None,
857            annotation_ref: Vec::new(),
858        }
859    }
860}
861#[cfg_attr(
862    feature = "python",
863    pyclass(
864        module = "ome_metadata",
865        skip_from_py_object,
866        get_all,
867        set_all,
868        eq,
869        new = "from_fields"
870    ),
871    derive(FromPyObject, PyOme)
872)]
873#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
874pub struct DetectorSettings {
875    #[serde(rename = "@ID")]
876    pub id: String,
877    #[serde(default, rename = "@Offset", skip_serializing_if = "Option::is_none")]
878    pub offset: Option<f32>,
879    #[serde(default, rename = "@Gain", skip_serializing_if = "Option::is_none")]
880    pub gain: Option<f32>,
881    #[serde(default, rename = "@Voltage", skip_serializing_if = "Option::is_none")]
882    pub voltage: Option<f32>,
883    #[serde(
884        default = "DetectorSettings::default_voltage_unit",
885        rename = "@VoltageUnit"
886    )]
887    pub voltage_unit: UnitsElectricPotential,
888    #[serde(default, rename = "@Zoom", skip_serializing_if = "Option::is_none")]
889    pub zoom: Option<f32>,
890    #[serde(
891        default,
892        rename = "@ReadOutRate",
893        skip_serializing_if = "Option::is_none"
894    )]
895    pub read_out_rate: Option<f32>,
896    #[serde(
897        default = "DetectorSettings::default_read_out_rate_unit",
898        rename = "@ReadOutRateUnit"
899    )]
900    pub read_out_rate_unit: UnitsFrequency,
901    #[serde(default, rename = "@Binning", skip_serializing_if = "Option::is_none")]
902    pub binning: Option<BinningType>,
903    #[serde(
904        default,
905        rename = "@Integration",
906        skip_serializing_if = "Option::is_none"
907    )]
908    pub integration: Option<i32>,
909}
910impl DetectorSettings {
911    pub fn default_voltage_unit() -> UnitsElectricPotential {
912        UnitsElectricPotential::V
913    }
914    pub fn default_read_out_rate_unit() -> UnitsFrequency {
915        UnitsFrequency::Hz
916    }
917}
918impl Default for DetectorSettings {
919    fn default() -> Self {
920        Self {
921            id: String::new(),
922            offset: None,
923            gain: None,
924            voltage: None,
925            voltage_unit: Self::default_voltage_unit(),
926            zoom: None,
927            read_out_rate: None,
928            read_out_rate_unit: Self::default_read_out_rate_unit(),
929            binning: None,
930            integration: None,
931        }
932    }
933}
934#[derive(
935    EnumString,
936    AsRefStr,
937    Debug,
938    strum::Display,
939    Clone,
940    Copy,
941    PartialEq,
942    Eq,
943    PartialOrd,
944    Ord,
945    Hash,
946    Deserialize,
947    Serialize,
948    VariantNames,
949    OmeXML,
950)]
951#[strum(ascii_case_insensitive)]
952#[cfg_attr(
953    feature = "python",
954    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
955    derive(PyOmeEnum)
956)]
957pub enum DetectorType {
958    #[serde(rename = "CCD")]
959    Ccd,
960    #[serde(rename = "IntensifiedCCD")]
961    IntensifiedCcd,
962    #[serde(rename = "AnalogVideo")]
963    AnalogVideo,
964    #[serde(rename = "PMT")]
965    Pmt,
966    #[serde(rename = "Photodiode")]
967    Photodiode,
968    #[serde(rename = "Spectroscopy")]
969    Spectroscopy,
970    #[serde(rename = "LifetimeImaging")]
971    LifetimeImaging,
972    #[serde(rename = "CorrelationSpectroscopy")]
973    CorrelationSpectroscopy,
974    #[serde(rename = "FTIR")]
975    Ftir,
976    #[serde(rename = "EMCCD")]
977    Emccd,
978    #[serde(rename = "APD")]
979    Apd,
980    #[serde(rename = "CMOS")]
981    Cmos,
982    #[serde(rename = "EBCCD")]
983    Ebccd,
984    #[serde(rename = "Other")]
985    Other,
986}
987#[cfg_attr(
988    feature = "python",
989    pyclass(
990        module = "ome_metadata",
991        skip_from_py_object,
992        get_all,
993        set_all,
994        eq,
995        new = "from_fields"
996    ),
997    derive(FromPyObject, PyOme)
998)]
999#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1000pub struct Dichroic {
1001    #[serde(
1002        default,
1003        rename = "@Manufacturer",
1004        skip_serializing_if = "Option::is_none"
1005    )]
1006    pub manufacturer: Option<String>,
1007    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
1008    pub model: Option<String>,
1009    #[serde(
1010        default,
1011        rename = "@SerialNumber",
1012        skip_serializing_if = "Option::is_none"
1013    )]
1014    pub serial_number: Option<String>,
1015    #[serde(
1016        default,
1017        rename = "@LotNumber",
1018        skip_serializing_if = "Option::is_none"
1019    )]
1020    pub lot_number: Option<String>,
1021    #[serde(rename = "@ID")]
1022    pub id: String,
1023    #[serde(
1024        default,
1025        rename = "AnnotationRef",
1026        skip_serializing_if = "Vec::is_empty"
1027    )]
1028    pub annotation_ref: Vec<AnnotationRef>,
1029}
1030#[cfg_attr(
1031    feature = "python",
1032    pyclass(
1033        module = "ome_metadata",
1034        skip_from_py_object,
1035        get_all,
1036        set_all,
1037        eq,
1038        new = "from_fields"
1039    ),
1040    derive(FromPyObject, PyOme)
1041)]
1042#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1043pub struct DoubleAnnotation {
1044    #[serde(rename = "@ID")]
1045    pub id: String,
1046    #[serde(
1047        default,
1048        rename = "@Namespace",
1049        skip_serializing_if = "Option::is_none"
1050    )]
1051    pub namespace: Option<String>,
1052    #[serde(
1053        default,
1054        rename = "@Annotator",
1055        skip_serializing_if = "Option::is_none"
1056    )]
1057    pub annotator: Option<String>,
1058    #[serde(
1059        default,
1060        rename = "Description",
1061        skip_serializing_if = "Option::is_none"
1062    )]
1063    pub description: Option<String>,
1064    #[serde(
1065        default,
1066        rename = "AnnotationRef",
1067        skip_serializing_if = "Vec::is_empty"
1068    )]
1069    pub annotation_ref: Vec<AnnotationRef>,
1070    #[serde(rename = "Value")]
1071    pub value: f64,
1072}
1073#[cfg_attr(
1074    feature = "python",
1075    pyclass(
1076        module = "ome_metadata",
1077        skip_from_py_object,
1078        get_all,
1079        set_all,
1080        eq,
1081        new = "from_fields"
1082    ),
1083    derive(FromPyObject, PyOme)
1084)]
1085#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1086pub struct Ellipse {
1087    #[serde(
1088        default,
1089        rename = "@FillColor",
1090        skip_serializing_if = "Option::is_none"
1091    )]
1092    pub fill_color: Option<i32>,
1093    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
1094    pub fill_rule: Option<ShapeFillRuleType>,
1095    #[serde(
1096        default,
1097        rename = "@StrokeColor",
1098        skip_serializing_if = "Option::is_none"
1099    )]
1100    pub stroke_color: Option<i32>,
1101    #[serde(
1102        default,
1103        rename = "@StrokeWidth",
1104        skip_serializing_if = "Option::is_none"
1105    )]
1106    pub stroke_width: Option<f32>,
1107    #[serde(
1108        default = "Ellipse::default_stroke_width_unit",
1109        rename = "@StrokeWidthUnit"
1110    )]
1111    pub stroke_width_unit: UnitsLength,
1112    #[serde(
1113        default,
1114        rename = "@StrokeDashArray",
1115        skip_serializing_if = "Option::is_none"
1116    )]
1117    pub stroke_dash_array: Option<String>,
1118    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
1119    pub text: Option<String>,
1120    #[serde(
1121        default,
1122        rename = "@FontFamily",
1123        skip_serializing_if = "Option::is_none"
1124    )]
1125    pub font_family: Option<FontFamilyType>,
1126    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
1127    pub font_size: Option<i32>,
1128    #[serde(default = "Ellipse::default_font_size_unit", rename = "@FontSizeUnit")]
1129    pub font_size_unit: UnitsLength,
1130    #[serde(
1131        default,
1132        rename = "@FontStyle",
1133        skip_serializing_if = "Option::is_none"
1134    )]
1135    pub font_style: Option<ShapeFontStyleType>,
1136    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
1137    pub locked: Option<bool>,
1138    #[serde(rename = "@ID")]
1139    pub id: String,
1140    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
1141    pub the_z: Option<i32>,
1142    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
1143    pub the_t: Option<i32>,
1144    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
1145    pub the_c: Option<i32>,
1146    #[serde(rename = "@X")]
1147    pub x: f32,
1148    #[serde(rename = "@Y")]
1149    pub y: f32,
1150    #[serde(rename = "@RadiusX")]
1151    pub radius_x: f32,
1152    #[serde(rename = "@RadiusY")]
1153    pub radius_y: f32,
1154    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
1155    pub transform: Option<AffineTransform>,
1156    #[serde(
1157        default,
1158        rename = "AnnotationRef",
1159        skip_serializing_if = "Vec::is_empty"
1160    )]
1161    pub annotation_ref: Vec<AnnotationRef>,
1162}
1163impl Ellipse {
1164    pub fn default_stroke_width_unit() -> UnitsLength {
1165        UnitsLength::Pixel
1166    }
1167    pub fn default_font_size_unit() -> UnitsLength {
1168        UnitsLength::Pixel
1169    }
1170}
1171impl Default for Ellipse {
1172    fn default() -> Self {
1173        Self {
1174            fill_color: None,
1175            fill_rule: None,
1176            stroke_color: None,
1177            stroke_width: None,
1178            stroke_width_unit: Self::default_stroke_width_unit(),
1179            stroke_dash_array: None,
1180            text: None,
1181            font_family: None,
1182            font_size: None,
1183            font_size_unit: Self::default_font_size_unit(),
1184            font_style: None,
1185            locked: None,
1186            id: String::new(),
1187            the_z: None,
1188            the_t: None,
1189            the_c: None,
1190            x: 0.0,
1191            y: 0.0,
1192            radius_x: 0.0,
1193            radius_y: 0.0,
1194            transform: None,
1195            annotation_ref: Vec::new(),
1196        }
1197    }
1198}
1199#[cfg_attr(
1200    feature = "python",
1201    pyclass(
1202        module = "ome_metadata",
1203        skip_from_py_object,
1204        get_all,
1205        set_all,
1206        eq,
1207        new = "from_fields"
1208    ),
1209    derive(FromPyObject, PyOme)
1210)]
1211#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1212pub struct Experiment {
1213    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
1214    pub r#type: Option<ExperimentType>,
1215    #[serde(rename = "@ID")]
1216    pub id: String,
1217    #[serde(
1218        default,
1219        rename = "Description",
1220        skip_serializing_if = "Option::is_none"
1221    )]
1222    pub description: Option<String>,
1223    #[serde(
1224        default,
1225        rename = "ExperimenterRef",
1226        skip_serializing_if = "Option::is_none"
1227    )]
1228    pub experimenter_ref: Option<AnnotationRef>,
1229    #[serde(
1230        default,
1231        rename = "MicrobeamManipulation",
1232        skip_serializing_if = "Vec::is_empty"
1233    )]
1234    pub microbeam_manipulation: Vec<MicrobeamManipulation>,
1235}
1236#[derive(
1237    EnumString,
1238    AsRefStr,
1239    Debug,
1240    strum::Display,
1241    Clone,
1242    Copy,
1243    PartialEq,
1244    Eq,
1245    PartialOrd,
1246    Ord,
1247    Hash,
1248    Deserialize,
1249    Serialize,
1250    VariantNames,
1251    OmeXML,
1252)]
1253#[strum(ascii_case_insensitive)]
1254#[cfg_attr(
1255    feature = "python",
1256    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
1257    derive(PyOmeEnum)
1258)]
1259pub enum ExperimentItemType {
1260    #[serde(rename = "FP")]
1261    Fp,
1262    #[serde(rename = "FRET")]
1263    Fret,
1264    #[serde(rename = "TimeLapse")]
1265    TimeLapse,
1266    #[serde(rename = "FourDPlus")]
1267    FourDPlus,
1268    #[serde(rename = "Screen")]
1269    Screen,
1270    #[serde(rename = "Immunocytochemistry")]
1271    Immunocytochemistry,
1272    #[serde(rename = "Immunofluorescence")]
1273    Immunofluorescence,
1274    #[serde(rename = "FISH")]
1275    Fish,
1276    #[serde(rename = "Electrophysiology")]
1277    Electrophysiology,
1278    #[serde(rename = "IonImaging")]
1279    IonImaging,
1280    #[serde(rename = "Colocalization")]
1281    Colocalization,
1282    #[serde(rename = "PGIDocumentation")]
1283    PgiDocumentation,
1284    #[serde(rename = "FluorescenceLifetime")]
1285    FluorescenceLifetime,
1286    #[serde(rename = "SpectralImaging")]
1287    SpectralImaging,
1288    #[serde(rename = "Photobleaching")]
1289    Photobleaching,
1290    #[serde(rename = "SPIM")]
1291    Spim,
1292    #[serde(rename = "Other")]
1293    Other,
1294}
1295#[cfg_attr(
1296    feature = "python",
1297    pyclass(module = "ome_metadata", skip_from_py_object, eq, new = "from_fields"),
1298    derive(FromPyObject)
1299)]
1300#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1301pub struct ExperimentType(pub Vec<ExperimentItemType>);
1302#[cfg_attr(
1303    feature = "python",
1304    pyclass(
1305        module = "ome_metadata",
1306        skip_from_py_object,
1307        get_all,
1308        set_all,
1309        eq,
1310        new = "from_fields"
1311    ),
1312    derive(FromPyObject, PyOme)
1313)]
1314#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1315pub struct Experimenter {
1316    #[serde(rename = "@ID")]
1317    pub id: String,
1318    #[serde(
1319        default,
1320        rename = "@FirstName",
1321        skip_serializing_if = "Option::is_none"
1322    )]
1323    pub first_name: Option<String>,
1324    #[serde(
1325        default,
1326        rename = "@MiddleName",
1327        skip_serializing_if = "Option::is_none"
1328    )]
1329    pub middle_name: Option<String>,
1330    #[serde(default, rename = "@LastName", skip_serializing_if = "Option::is_none")]
1331    pub last_name: Option<String>,
1332    #[serde(default, rename = "@Email", skip_serializing_if = "Option::is_none")]
1333    pub email: Option<String>,
1334    #[serde(
1335        default,
1336        rename = "@Institution",
1337        skip_serializing_if = "Option::is_none"
1338    )]
1339    pub institution: Option<String>,
1340    #[serde(default, rename = "@UserName", skip_serializing_if = "Option::is_none")]
1341    pub user_name: Option<String>,
1342    #[serde(
1343        default,
1344        rename = "AnnotationRef",
1345        skip_serializing_if = "Vec::is_empty"
1346    )]
1347    pub annotation_ref: Vec<AnnotationRef>,
1348}
1349#[cfg_attr(
1350    feature = "python",
1351    pyclass(
1352        module = "ome_metadata",
1353        skip_from_py_object,
1354        get_all,
1355        set_all,
1356        eq,
1357        new = "from_fields"
1358    ),
1359    derive(FromPyObject, PyOme)
1360)]
1361#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1362pub struct ExperimenterGroup {
1363    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
1364    pub name: Option<String>,
1365    #[serde(rename = "@ID")]
1366    pub id: String,
1367    #[serde(
1368        default,
1369        rename = "Description",
1370        skip_serializing_if = "Option::is_none"
1371    )]
1372    pub description: Option<String>,
1373    #[serde(
1374        default,
1375        rename = "ExperimenterRef",
1376        skip_serializing_if = "Vec::is_empty"
1377    )]
1378    pub experimenter_ref: Vec<AnnotationRef>,
1379    #[serde(default, rename = "Leader", skip_serializing_if = "Vec::is_empty")]
1380    pub leader: Vec<AnnotationRef>,
1381    #[serde(
1382        default,
1383        rename = "AnnotationRef",
1384        skip_serializing_if = "Vec::is_empty"
1385    )]
1386    pub annotation_ref: Vec<AnnotationRef>,
1387}
1388#[cfg_attr(
1389    feature = "python",
1390    pyclass(
1391        module = "ome_metadata",
1392        skip_from_py_object,
1393        get_all,
1394        set_all,
1395        eq,
1396        new = "from_fields"
1397    ),
1398    derive(FromPyObject, PyOme)
1399)]
1400#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1401pub struct External {
1402    #[serde(rename = "@href")]
1403    pub href: String,
1404    #[serde(rename = "@SHA1")]
1405    pub sha_1: String,
1406    #[serde(default = "External::default_compression", rename = "@Compression")]
1407    pub compression: BinDataCompressionType,
1408}
1409impl External {
1410    pub fn default_compression() -> BinDataCompressionType {
1411        BinDataCompressionType::None
1412    }
1413}
1414#[cfg_attr(
1415    feature = "python",
1416    pyclass(
1417        module = "ome_metadata",
1418        skip_from_py_object,
1419        get_all,
1420        set_all,
1421        eq,
1422        new = "from_fields"
1423    ),
1424    derive(FromPyObject, PyOme)
1425)]
1426#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1427pub struct Filament {
1428    #[serde(
1429        default,
1430        rename = "@Manufacturer",
1431        skip_serializing_if = "Option::is_none"
1432    )]
1433    pub manufacturer: Option<String>,
1434    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
1435    pub model: Option<String>,
1436    #[serde(
1437        default,
1438        rename = "@SerialNumber",
1439        skip_serializing_if = "Option::is_none"
1440    )]
1441    pub serial_number: Option<String>,
1442    #[serde(
1443        default,
1444        rename = "@LotNumber",
1445        skip_serializing_if = "Option::is_none"
1446    )]
1447    pub lot_number: Option<String>,
1448    #[serde(rename = "@ID")]
1449    pub id: String,
1450    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
1451    pub power: Option<f32>,
1452    #[serde(default = "Filament::default_power_unit", rename = "@PowerUnit")]
1453    pub power_unit: UnitsPower,
1454    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
1455    pub r#type: Option<FilamentType>,
1456    #[serde(
1457        default,
1458        rename = "AnnotationRef",
1459        skip_serializing_if = "Vec::is_empty"
1460    )]
1461    pub annotation_ref: Vec<AnnotationRef>,
1462}
1463impl Filament {
1464    pub fn default_power_unit() -> UnitsPower {
1465        UnitsPower::W
1466    }
1467}
1468impl Default for Filament {
1469    fn default() -> Self {
1470        Self {
1471            manufacturer: None,
1472            model: None,
1473            serial_number: None,
1474            lot_number: None,
1475            id: String::new(),
1476            power: None,
1477            power_unit: Self::default_power_unit(),
1478            r#type: None,
1479            annotation_ref: Vec::new(),
1480        }
1481    }
1482}
1483
1484#[derive(
1485    EnumString,
1486    AsRefStr,
1487    Debug,
1488    strum::Display,
1489    Clone,
1490    Copy,
1491    PartialEq,
1492    Eq,
1493    PartialOrd,
1494    Ord,
1495    Hash,
1496    Deserialize,
1497    Serialize,
1498    VariantNames,
1499    OmeXML,
1500)]
1501#[strum(ascii_case_insensitive)]
1502#[cfg_attr(
1503    feature = "python",
1504    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
1505    derive(PyOmeEnum)
1506)]
1507pub enum FilamentType {
1508    #[serde(rename = "Incandescent")]
1509    Incandescent,
1510    #[serde(rename = "Halogen")]
1511    Halogen,
1512    #[serde(rename = "Other")]
1513    Other,
1514}
1515#[cfg_attr(
1516    feature = "python",
1517    pyclass(
1518        module = "ome_metadata",
1519        skip_from_py_object,
1520        get_all,
1521        set_all,
1522        eq,
1523        new = "from_fields"
1524    ),
1525    derive(FromPyObject, PyOme)
1526)]
1527#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1528pub struct FileAnnotation {
1529    #[serde(rename = "@ID")]
1530    pub id: String,
1531    #[serde(
1532        default,
1533        rename = "@Namespace",
1534        skip_serializing_if = "Option::is_none"
1535    )]
1536    pub namespace: Option<String>,
1537    #[serde(
1538        default,
1539        rename = "@Annotator",
1540        skip_serializing_if = "Option::is_none"
1541    )]
1542    pub annotator: Option<String>,
1543    #[serde(
1544        default,
1545        rename = "Description",
1546        skip_serializing_if = "Option::is_none"
1547    )]
1548    pub description: Option<String>,
1549    #[serde(
1550        default,
1551        rename = "AnnotationRef",
1552        skip_serializing_if = "Vec::is_empty"
1553    )]
1554    pub annotation_ref: Vec<AnnotationRef>,
1555    #[serde(rename = "BinaryFile")]
1556    pub binary_file: BinaryFile,
1557}
1558#[cfg_attr(
1559    feature = "python",
1560    pyclass(
1561        module = "ome_metadata",
1562        skip_from_py_object,
1563        get_all,
1564        set_all,
1565        eq,
1566        new = "from_fields"
1567    ),
1568    derive(FromPyObject, PyOme)
1569)]
1570#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1571pub struct Filter {
1572    #[serde(
1573        default,
1574        rename = "@Manufacturer",
1575        skip_serializing_if = "Option::is_none"
1576    )]
1577    pub manufacturer: Option<String>,
1578    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
1579    pub model: Option<String>,
1580    #[serde(
1581        default,
1582        rename = "@SerialNumber",
1583        skip_serializing_if = "Option::is_none"
1584    )]
1585    pub serial_number: Option<String>,
1586    #[serde(
1587        default,
1588        rename = "@LotNumber",
1589        skip_serializing_if = "Option::is_none"
1590    )]
1591    pub lot_number: Option<String>,
1592    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
1593    pub r#type: Option<FilterType>,
1594    #[serde(
1595        default,
1596        rename = "@FilterWheel",
1597        skip_serializing_if = "Option::is_none"
1598    )]
1599    pub filter_wheel: Option<String>,
1600    #[serde(rename = "@ID")]
1601    pub id: String,
1602    #[serde(
1603        default,
1604        rename = "TransmittanceRange",
1605        skip_serializing_if = "Option::is_none"
1606    )]
1607    pub transmittance_range: Option<TransmittanceRange>,
1608    #[serde(
1609        default,
1610        rename = "AnnotationRef",
1611        skip_serializing_if = "Vec::is_empty"
1612    )]
1613    pub annotation_ref: Vec<AnnotationRef>,
1614}
1615#[cfg_attr(
1616    feature = "python",
1617    pyclass(
1618        module = "ome_metadata",
1619        skip_from_py_object,
1620        get_all,
1621        set_all,
1622        eq,
1623        new = "from_fields"
1624    ),
1625    derive(FromPyObject, PyOme)
1626)]
1627#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1628pub struct FilterSet {
1629    #[serde(
1630        default,
1631        rename = "@Manufacturer",
1632        skip_serializing_if = "Option::is_none"
1633    )]
1634    pub manufacturer: Option<String>,
1635    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
1636    pub model: Option<String>,
1637    #[serde(
1638        default,
1639        rename = "@SerialNumber",
1640        skip_serializing_if = "Option::is_none"
1641    )]
1642    pub serial_number: Option<String>,
1643    #[serde(
1644        default,
1645        rename = "@LotNumber",
1646        skip_serializing_if = "Option::is_none"
1647    )]
1648    pub lot_number: Option<String>,
1649    #[serde(rename = "@ID")]
1650    pub id: String,
1651    #[serde(
1652        default,
1653        rename = "ExcitationFilterRef",
1654        skip_serializing_if = "Vec::is_empty"
1655    )]
1656    pub excitation_filter_ref: Vec<AnnotationRef>,
1657    #[serde(
1658        default,
1659        rename = "DichroicRef",
1660        skip_serializing_if = "Option::is_none"
1661    )]
1662    pub dichroic_ref: Option<AnnotationRef>,
1663    #[serde(
1664        default,
1665        rename = "EmissionFilterRef",
1666        skip_serializing_if = "Vec::is_empty"
1667    )]
1668    pub emission_filter_ref: Vec<AnnotationRef>,
1669}
1670#[derive(
1671    EnumString,
1672    AsRefStr,
1673    Debug,
1674    strum::Display,
1675    Clone,
1676    Copy,
1677    PartialEq,
1678    Eq,
1679    PartialOrd,
1680    Ord,
1681    Hash,
1682    Deserialize,
1683    Serialize,
1684    VariantNames,
1685    OmeXML,
1686)]
1687#[strum(ascii_case_insensitive)]
1688#[cfg_attr(
1689    feature = "python",
1690    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
1691    derive(PyOmeEnum)
1692)]
1693pub enum FilterType {
1694    #[serde(rename = "Dichroic")]
1695    Dichroic,
1696    #[serde(rename = "LongPass")]
1697    LongPass,
1698    #[serde(rename = "ShortPass")]
1699    ShortPass,
1700    #[serde(rename = "BandPass")]
1701    BandPass,
1702    #[serde(rename = "MultiPass")]
1703    MultiPass,
1704    #[serde(rename = "NeutralDensity")]
1705    NeutralDensity,
1706    #[serde(rename = "Tuneable")]
1707    Tuneable,
1708    #[serde(rename = "Other")]
1709    Other,
1710}
1711#[cfg_attr(
1712    feature = "python",
1713    pyclass(
1714        module = "ome_metadata",
1715        skip_from_py_object,
1716        get_all,
1717        set_all,
1718        eq,
1719        new = "from_fields"
1720    ),
1721    derive(FromPyObject, PyOme)
1722)]
1723#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
1724pub struct Folder {
1725    #[serde(rename = "@ID")]
1726    pub id: String,
1727    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
1728    pub name: Option<String>,
1729    #[serde(
1730        default,
1731        rename = "Description",
1732        skip_serializing_if = "Option::is_none"
1733    )]
1734    pub description: Option<String>,
1735    #[serde(default, rename = "FolderRef", skip_serializing_if = "Vec::is_empty")]
1736    pub folder_ref: Vec<AnnotationRef>,
1737    #[serde(default, rename = "ImageRef", skip_serializing_if = "Vec::is_empty")]
1738    pub image_ref: Vec<AnnotationRef>,
1739    #[serde(default, rename = "ROIRef", skip_serializing_if = "Vec::is_empty")]
1740    pub roi_ref: Vec<AnnotationRef>,
1741    #[serde(
1742        default,
1743        rename = "AnnotationRef",
1744        skip_serializing_if = "Vec::is_empty"
1745    )]
1746    pub annotation_ref: Vec<AnnotationRef>,
1747}
1748#[derive(
1749    EnumString,
1750    AsRefStr,
1751    Debug,
1752    strum::Display,
1753    Clone,
1754    Copy,
1755    PartialEq,
1756    Eq,
1757    PartialOrd,
1758    Ord,
1759    Hash,
1760    Deserialize,
1761    Serialize,
1762    VariantNames,
1763    OmeXML,
1764)]
1765#[strum(ascii_case_insensitive)]
1766#[cfg_attr(
1767    feature = "python",
1768    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
1769    derive(PyOmeEnum)
1770)]
1771pub enum FontFamilyType {
1772    #[serde(rename = "serif")]
1773    Serif,
1774    #[serde(rename = "sans-serif")]
1775    SansSerif,
1776    #[serde(rename = "cursive")]
1777    Cursive,
1778    #[serde(rename = "fantasy")]
1779    Fantasy,
1780    #[serde(rename = "monospace")]
1781    Monospace,
1782}
1783#[cfg_attr(
1784    feature = "python",
1785    pyclass(
1786        module = "ome_metadata",
1787        skip_from_py_object,
1788        get_all,
1789        set_all,
1790        eq,
1791        new = "from_fields"
1792    ),
1793    derive(FromPyObject, PyOme)
1794)]
1795#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1796pub struct GenericExcitationSource {
1797    #[serde(
1798        default,
1799        rename = "@Manufacturer",
1800        skip_serializing_if = "Option::is_none"
1801    )]
1802    pub manufacturer: Option<String>,
1803    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
1804    pub model: Option<String>,
1805    #[serde(
1806        default,
1807        rename = "@SerialNumber",
1808        skip_serializing_if = "Option::is_none"
1809    )]
1810    pub serial_number: Option<String>,
1811    #[serde(
1812        default,
1813        rename = "@LotNumber",
1814        skip_serializing_if = "Option::is_none"
1815    )]
1816    pub lot_number: Option<String>,
1817    #[serde(rename = "@ID")]
1818    pub id: String,
1819    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
1820    pub power: Option<f32>,
1821    #[serde(
1822        default = "GenericExcitationSource::default_power_unit",
1823        rename = "@PowerUnit"
1824    )]
1825    pub power_unit: UnitsPower,
1826    #[serde(
1827        default,
1828        rename = "AnnotationRef",
1829        skip_serializing_if = "Vec::is_empty"
1830    )]
1831    pub annotation_ref: Vec<AnnotationRef>,
1832    #[serde(default, rename = "Map", skip_serializing_if = "Option::is_none")]
1833    pub map: Option<MapType>,
1834}
1835impl GenericExcitationSource {
1836    pub fn default_power_unit() -> UnitsPower {
1837        UnitsPower::W
1838    }
1839}
1840impl Default for GenericExcitationSource {
1841    fn default() -> Self {
1842        Self {
1843            manufacturer: None,
1844            model: None,
1845            serial_number: None,
1846            lot_number: None,
1847            id: String::new(),
1848            power: None,
1849            power_unit: Self::default_power_unit(),
1850            annotation_ref: Vec::new(),
1851            map: None,
1852        }
1853    }
1854}
1855#[cfg_attr(
1856    feature = "python",
1857    pyclass(
1858        module = "ome_metadata",
1859        skip_from_py_object,
1860        get_all,
1861        set_all,
1862        eq,
1863        new = "from_fields"
1864    ),
1865    derive(FromPyObject, PyOme)
1866)]
1867#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1868pub struct Image {
1869    #[serde(rename = "@ID")]
1870    pub id: String,
1871    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
1872    pub name: Option<String>,
1873    #[serde(
1874        default,
1875        rename = "AcquisitionDate",
1876        skip_serializing_if = "Option::is_none"
1877    )]
1878    pub acquisition_date: Option<String>,
1879    #[serde(
1880        default,
1881        rename = "ExperimenterRef",
1882        skip_serializing_if = "Option::is_none"
1883    )]
1884    pub experimenter_ref: Option<AnnotationRef>,
1885    #[serde(
1886        default,
1887        rename = "Description",
1888        skip_serializing_if = "Option::is_none"
1889    )]
1890    pub description: Option<String>,
1891    #[serde(
1892        default,
1893        rename = "ExperimentRef",
1894        skip_serializing_if = "Option::is_none"
1895    )]
1896    pub experiment_ref: Option<AnnotationRef>,
1897    #[serde(
1898        default,
1899        rename = "ExperimenterGroupRef",
1900        skip_serializing_if = "Option::is_none"
1901    )]
1902    pub experimenter_group_ref: Option<AnnotationRef>,
1903    #[serde(
1904        default,
1905        rename = "InstrumentRef",
1906        skip_serializing_if = "Option::is_none"
1907    )]
1908    pub instrument_ref: Option<AnnotationRef>,
1909    #[serde(
1910        default,
1911        rename = "ObjectiveSettings",
1912        skip_serializing_if = "Option::is_none"
1913    )]
1914    pub objective_settings: Option<ObjectiveSettings>,
1915    #[serde(
1916        default,
1917        rename = "ImagingEnvironment",
1918        skip_serializing_if = "Option::is_none"
1919    )]
1920    pub imaging_environment: Option<ImagingEnvironment>,
1921    #[serde(
1922        default,
1923        rename = "StageLabel",
1924        skip_serializing_if = "Option::is_none"
1925    )]
1926    pub stage_label: Option<StageLabel>,
1927    #[serde(rename = "Pixels")]
1928    pub pixels: Pixels,
1929    #[serde(default, rename = "ROIRef", skip_serializing_if = "Vec::is_empty")]
1930    pub roi_ref: Vec<AnnotationRef>,
1931    #[serde(
1932        default,
1933        rename = "MicrobeamManipulationRef",
1934        skip_serializing_if = "Vec::is_empty"
1935    )]
1936    pub microbeam_manipulation_ref: Vec<AnnotationRef>,
1937    #[serde(
1938        default,
1939        rename = "AnnotationRef",
1940        skip_serializing_if = "Vec::is_empty"
1941    )]
1942    pub annotation_ref: Vec<AnnotationRef>,
1943}
1944#[cfg_attr(
1945    feature = "python",
1946    pyclass(
1947        module = "ome_metadata",
1948        skip_from_py_object,
1949        get_all,
1950        set_all,
1951        eq,
1952        new = "from_fields"
1953    ),
1954    derive(FromPyObject, PyOme)
1955)]
1956#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
1957pub struct ImagingEnvironment {
1958    #[serde(
1959        default,
1960        rename = "@Temperature",
1961        skip_serializing_if = "Option::is_none"
1962    )]
1963    pub temperature: Option<f32>,
1964    #[serde(
1965        default = "ImagingEnvironment::default_temperature_unit",
1966        rename = "@TemperatureUnit"
1967    )]
1968    pub temperature_unit: UnitsTemperature,
1969    #[serde(
1970        default,
1971        rename = "@AirPressure",
1972        skip_serializing_if = "Option::is_none"
1973    )]
1974    pub air_pressure: Option<f32>,
1975    #[serde(
1976        default = "ImagingEnvironment::default_air_pressure_unit",
1977        rename = "@AirPressureUnit"
1978    )]
1979    pub air_pressure_unit: UnitsPressure,
1980    #[serde(default, rename = "@Humidity", skip_serializing_if = "Option::is_none")]
1981    pub humidity: Option<f32>,
1982    #[serde(
1983        default,
1984        rename = "@CO2Percent",
1985        skip_serializing_if = "Option::is_none"
1986    )]
1987    pub co_2_percent: Option<f32>,
1988    #[serde(default, rename = "Map", skip_serializing_if = "Option::is_none")]
1989    pub map: Option<MapType>,
1990}
1991impl ImagingEnvironment {
1992    pub fn default_temperature_unit() -> UnitsTemperature {
1993        UnitsTemperature::C
1994    }
1995    pub fn default_air_pressure_unit() -> UnitsPressure {
1996        UnitsPressure::atm
1997    }
1998}
1999impl Default for ImagingEnvironment {
2000    fn default() -> Self {
2001        Self {
2002            temperature: None,
2003            temperature_unit: Self::default_temperature_unit(),
2004            air_pressure: None,
2005            air_pressure_unit: Self::default_air_pressure_unit(),
2006            humidity: None,
2007            co_2_percent: None,
2008            map: None,
2009        }
2010    }
2011}
2012#[cfg_attr(
2013    feature = "python",
2014    pyclass(
2015        module = "ome_metadata",
2016        skip_from_py_object,
2017        get_all,
2018        set_all,
2019        eq,
2020        new = "from_fields"
2021    ),
2022    derive(FromPyObject, PyOme)
2023)]
2024#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2025pub struct Instrument {
2026    #[serde(rename = "@ID")]
2027    pub id: String,
2028    #[serde(
2029        default,
2030        rename = "Microscope",
2031        skip_serializing_if = "Option::is_none"
2032    )]
2033    pub microscope: Option<Microscope>,
2034    #[serde(
2035        default,
2036        rename = "LightSourceGroup",
2037        skip_serializing_if = "Vec::is_empty"
2038    )]
2039    pub light_source_group: Vec<LightSourceGroup>,
2040    #[serde(default, rename = "Detector", skip_serializing_if = "Vec::is_empty")]
2041    pub detector: Vec<Detector>,
2042    #[serde(default, rename = "Objective", skip_serializing_if = "Vec::is_empty")]
2043    pub objective: Vec<Objective>,
2044    #[serde(default, rename = "FilterSet", skip_serializing_if = "Vec::is_empty")]
2045    pub filter_set: Vec<FilterSet>,
2046    #[serde(default, rename = "Filter", skip_serializing_if = "Vec::is_empty")]
2047    pub filter: Vec<Filter>,
2048    #[serde(default, rename = "Dichroic", skip_serializing_if = "Vec::is_empty")]
2049    pub dichroic: Vec<Dichroic>,
2050    #[serde(
2051        default,
2052        rename = "AnnotationRef",
2053        skip_serializing_if = "Vec::is_empty"
2054    )]
2055    pub annotation_ref: Vec<AnnotationRef>,
2056}
2057#[cfg_attr(
2058    feature = "python",
2059    pyclass(
2060        module = "ome_metadata",
2061        skip_from_py_object,
2062        get_all,
2063        set_all,
2064        eq,
2065        new = "from_fields"
2066    ),
2067    derive(FromPyObject, PyOme)
2068)]
2069#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2070pub struct Label {
2071    #[serde(
2072        default,
2073        rename = "@FillColor",
2074        skip_serializing_if = "Option::is_none"
2075    )]
2076    pub fill_color: Option<i32>,
2077    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
2078    pub fill_rule: Option<ShapeFillRuleType>,
2079    #[serde(
2080        default,
2081        rename = "@StrokeColor",
2082        skip_serializing_if = "Option::is_none"
2083    )]
2084    pub stroke_color: Option<i32>,
2085    #[serde(
2086        default,
2087        rename = "@StrokeWidth",
2088        skip_serializing_if = "Option::is_none"
2089    )]
2090    pub stroke_width: Option<f32>,
2091    #[serde(
2092        default = "Label::default_stroke_width_unit",
2093        rename = "@StrokeWidthUnit"
2094    )]
2095    pub stroke_width_unit: UnitsLength,
2096    #[serde(
2097        default,
2098        rename = "@StrokeDashArray",
2099        skip_serializing_if = "Option::is_none"
2100    )]
2101    pub stroke_dash_array: Option<String>,
2102    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
2103    pub text: Option<String>,
2104    #[serde(
2105        default,
2106        rename = "@FontFamily",
2107        skip_serializing_if = "Option::is_none"
2108    )]
2109    pub font_family: Option<FontFamilyType>,
2110    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
2111    pub font_size: Option<i32>,
2112    #[serde(default = "Label::default_font_size_unit", rename = "@FontSizeUnit")]
2113    pub font_size_unit: UnitsLength,
2114    #[serde(
2115        default,
2116        rename = "@FontStyle",
2117        skip_serializing_if = "Option::is_none"
2118    )]
2119    pub font_style: Option<ShapeFontStyleType>,
2120    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
2121    pub locked: Option<bool>,
2122    #[serde(rename = "@ID")]
2123    pub id: String,
2124    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
2125    pub the_z: Option<i32>,
2126    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
2127    pub the_t: Option<i32>,
2128    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
2129    pub the_c: Option<i32>,
2130    #[serde(rename = "@X")]
2131    pub x: f32,
2132    #[serde(rename = "@Y")]
2133    pub y: f32,
2134    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
2135    pub transform: Option<AffineTransform>,
2136    #[serde(
2137        default,
2138        rename = "AnnotationRef",
2139        skip_serializing_if = "Vec::is_empty"
2140    )]
2141    pub annotation_ref: Vec<AnnotationRef>,
2142}
2143impl Label {
2144    pub fn default_stroke_width_unit() -> UnitsLength {
2145        UnitsLength::Pixel
2146    }
2147    pub fn default_font_size_unit() -> UnitsLength {
2148        UnitsLength::Pixel
2149    }
2150}
2151impl Default for Label {
2152    fn default() -> Self {
2153        Self {
2154            fill_color: None,
2155            fill_rule: None,
2156            stroke_color: None,
2157            stroke_width: None,
2158            stroke_width_unit: Self::default_stroke_width_unit(),
2159            stroke_dash_array: None,
2160            text: None,
2161            font_family: None,
2162            font_size: None,
2163            font_size_unit: Self::default_font_size_unit(),
2164            font_style: None,
2165            locked: None,
2166            id: String::new(),
2167            the_z: None,
2168            the_t: None,
2169            the_c: None,
2170            x: 0.0,
2171            y: 0.0,
2172            transform: None,
2173            annotation_ref: Vec::new(),
2174        }
2175    }
2176}
2177#[cfg_attr(
2178    feature = "python",
2179    pyclass(
2180        module = "ome_metadata",
2181        skip_from_py_object,
2182        get_all,
2183        set_all,
2184        eq,
2185        new = "from_fields"
2186    ),
2187    derive(FromPyObject, PyOme)
2188)]
2189#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2190pub struct Laser {
2191    #[serde(
2192        default,
2193        rename = "@Manufacturer",
2194        skip_serializing_if = "Option::is_none"
2195    )]
2196    pub manufacturer: Option<String>,
2197    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
2198    pub model: Option<String>,
2199    #[serde(
2200        default,
2201        rename = "@SerialNumber",
2202        skip_serializing_if = "Option::is_none"
2203    )]
2204    pub serial_number: Option<String>,
2205    #[serde(
2206        default,
2207        rename = "@LotNumber",
2208        skip_serializing_if = "Option::is_none"
2209    )]
2210    pub lot_number: Option<String>,
2211    #[serde(rename = "@ID")]
2212    pub id: String,
2213    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
2214    pub power: Option<f32>,
2215    #[serde(default = "Laser::default_power_unit", rename = "@PowerUnit")]
2216    pub power_unit: UnitsPower,
2217    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
2218    pub r#type: Option<LaserType>,
2219    #[serde(
2220        default,
2221        rename = "@LaserMedium",
2222        skip_serializing_if = "Option::is_none"
2223    )]
2224    pub laser_medium: Option<LaserLaserMediumType>,
2225    #[serde(
2226        default,
2227        rename = "@Wavelength",
2228        skip_serializing_if = "Option::is_none"
2229    )]
2230    pub wavelength: Option<f32>,
2231    #[serde(default = "Laser::default_wavelength_unit", rename = "@WavelengthUnit")]
2232    pub wavelength_unit: UnitsLength,
2233    #[serde(
2234        default,
2235        rename = "@FrequencyMultiplication",
2236        skip_serializing_if = "Option::is_none"
2237    )]
2238    pub frequency_multiplication: Option<i32>,
2239    #[serde(default, rename = "@Tuneable", skip_serializing_if = "Option::is_none")]
2240    pub tuneable: Option<bool>,
2241    #[serde(default, rename = "@Pulse", skip_serializing_if = "Option::is_none")]
2242    pub pulse: Option<LaserPulseType>,
2243    #[serde(
2244        default,
2245        rename = "@PockelCell",
2246        skip_serializing_if = "Option::is_none"
2247    )]
2248    pub pockel_cell: Option<bool>,
2249    #[serde(
2250        default,
2251        rename = "@RepetitionRate",
2252        skip_serializing_if = "Option::is_none"
2253    )]
2254    pub repetition_rate: Option<f32>,
2255    #[serde(
2256        default = "Laser::default_repetition_rate_unit",
2257        rename = "@RepetitionRateUnit"
2258    )]
2259    pub repetition_rate_unit: UnitsFrequency,
2260    #[serde(
2261        default,
2262        rename = "AnnotationRef",
2263        skip_serializing_if = "Vec::is_empty"
2264    )]
2265    pub annotation_ref: Vec<AnnotationRef>,
2266    #[serde(default, rename = "Pump", skip_serializing_if = "Option::is_none")]
2267    pub pump: Option<AnnotationRef>,
2268}
2269impl Laser {
2270    pub fn default_power_unit() -> UnitsPower {
2271        UnitsPower::mW
2272    }
2273    pub fn default_wavelength_unit() -> UnitsLength {
2274        UnitsLength::nm
2275    }
2276    pub fn default_repetition_rate_unit() -> UnitsFrequency {
2277        UnitsFrequency::Hz
2278    }
2279}
2280impl Default for Laser {
2281    fn default() -> Self {
2282        Self {
2283            manufacturer: None,
2284            model: None,
2285            serial_number: None,
2286            lot_number: None,
2287            id: String::new(),
2288            power: None,
2289            power_unit: Self::default_power_unit(),
2290            r#type: None,
2291            laser_medium: None,
2292            wavelength: None,
2293            wavelength_unit: Self::default_wavelength_unit(),
2294            frequency_multiplication: None,
2295            tuneable: None,
2296            pulse: None,
2297            pockel_cell: None,
2298            repetition_rate: None,
2299            repetition_rate_unit: Self::default_repetition_rate_unit(),
2300            annotation_ref: Vec::new(),
2301            pump: None,
2302        }
2303    }
2304}
2305#[derive(
2306    EnumString,
2307    AsRefStr,
2308    Debug,
2309    strum::Display,
2310    Clone,
2311    Copy,
2312    PartialEq,
2313    Eq,
2314    PartialOrd,
2315    Ord,
2316    Hash,
2317    Deserialize,
2318    Serialize,
2319    VariantNames,
2320    OmeXML,
2321)]
2322#[strum(ascii_case_insensitive)]
2323#[cfg_attr(
2324    feature = "python",
2325    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
2326    derive(PyOmeEnum)
2327)]
2328pub enum LaserLaserMediumType {
2329    #[serde(rename = "Cu")]
2330    Cu,
2331    #[serde(rename = "Ag")]
2332    Ag,
2333    #[serde(rename = "ArFl")]
2334    ArFl,
2335    #[serde(rename = "ArCl")]
2336    ArCl,
2337    #[serde(rename = "KrFl")]
2338    KrFl,
2339    #[serde(rename = "KrCl")]
2340    KrCl,
2341    #[serde(rename = "XeFl")]
2342    XeFl,
2343    #[serde(rename = "XeCl")]
2344    XeCl,
2345    #[serde(rename = "XeBr")]
2346    XeBr,
2347    #[serde(rename = "N")]
2348    N,
2349    #[serde(rename = "Ar")]
2350    Ar,
2351    #[serde(rename = "Kr")]
2352    Kr,
2353    #[serde(rename = "Xe")]
2354    Xe,
2355    #[serde(rename = "HeNe")]
2356    HeNe,
2357    #[serde(rename = "HeCd")]
2358    HeCd,
2359    #[serde(rename = "CO")]
2360    Co,
2361    #[serde(rename = "CO2")]
2362    Co2,
2363    #[serde(rename = "H2O")]
2364    H2O,
2365    #[serde(rename = "HFl")]
2366    Hfl,
2367    #[serde(rename = "NdGlass")]
2368    NdGlass,
2369    #[serde(rename = "NdYAG")]
2370    NdYag,
2371    #[serde(rename = "ErGlass")]
2372    ErGlass,
2373    #[serde(rename = "ErYAG")]
2374    ErYag,
2375    #[serde(rename = "HoYLF")]
2376    HoYlf,
2377    #[serde(rename = "HoYAG")]
2378    HoYag,
2379    #[serde(rename = "Ruby")]
2380    Ruby,
2381    #[serde(rename = "TiSapphire")]
2382    TiSapphire,
2383    #[serde(rename = "Alexandrite")]
2384    Alexandrite,
2385    #[serde(rename = "Rhodamine6G")]
2386    Rhodamine6G,
2387    #[serde(rename = "CoumarinC30")]
2388    CoumarinC30,
2389    #[serde(rename = "GaAs")]
2390    GaAs,
2391    #[serde(rename = "GaAlAs")]
2392    GaAlAs,
2393    #[serde(rename = "EMinus")]
2394    Eminus,
2395    #[serde(rename = "Other")]
2396    Other,
2397}
2398#[derive(
2399    EnumString,
2400    AsRefStr,
2401    Debug,
2402    strum::Display,
2403    Clone,
2404    Copy,
2405    PartialEq,
2406    Eq,
2407    PartialOrd,
2408    Ord,
2409    Hash,
2410    Deserialize,
2411    Serialize,
2412    VariantNames,
2413    OmeXML,
2414)]
2415#[strum(ascii_case_insensitive)]
2416#[cfg_attr(
2417    feature = "python",
2418    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
2419    derive(PyOmeEnum)
2420)]
2421pub enum LaserPulseType {
2422    #[serde(rename = "CW")]
2423    Cw,
2424    #[serde(rename = "Single")]
2425    Single,
2426    #[serde(rename = "QSwitched")]
2427    Qswitched,
2428    #[serde(rename = "Repetitive")]
2429    Repetitive,
2430    #[serde(rename = "ModeLocked")]
2431    ModeLocked,
2432    #[serde(rename = "Other")]
2433    Other,
2434}
2435#[derive(
2436    EnumString,
2437    AsRefStr,
2438    Debug,
2439    strum::Display,
2440    Clone,
2441    Copy,
2442    PartialEq,
2443    Eq,
2444    PartialOrd,
2445    Ord,
2446    Hash,
2447    Deserialize,
2448    Serialize,
2449    VariantNames,
2450    OmeXML,
2451)]
2452#[strum(ascii_case_insensitive)]
2453#[cfg_attr(
2454    feature = "python",
2455    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
2456    derive(PyOmeEnum)
2457)]
2458pub enum LaserType {
2459    #[serde(rename = "Excimer")]
2460    Excimer,
2461    #[serde(rename = "Gas")]
2462    Gas,
2463    #[serde(rename = "MetalVapor")]
2464    MetalVapor,
2465    #[serde(rename = "SolidState")]
2466    SolidState,
2467    #[serde(rename = "Dye")]
2468    Dye,
2469    #[serde(rename = "Semiconductor")]
2470    Semiconductor,
2471    #[serde(rename = "FreeElectron")]
2472    FreeElectron,
2473    #[serde(rename = "Other")]
2474    Other,
2475}
2476#[cfg_attr(
2477    feature = "python",
2478    pyclass(
2479        module = "ome_metadata",
2480        skip_from_py_object,
2481        get_all,
2482        set_all,
2483        eq,
2484        new = "from_fields"
2485    ),
2486    derive(FromPyObject, PyOme)
2487)]
2488#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2489pub struct LightEmittingDiode {
2490    #[serde(
2491        default,
2492        rename = "@Manufacturer",
2493        skip_serializing_if = "Option::is_none"
2494    )]
2495    pub manufacturer: Option<String>,
2496    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
2497    pub model: Option<String>,
2498    #[serde(
2499        default,
2500        rename = "@SerialNumber",
2501        skip_serializing_if = "Option::is_none"
2502    )]
2503    pub serial_number: Option<String>,
2504    #[serde(
2505        default,
2506        rename = "@LotNumber",
2507        skip_serializing_if = "Option::is_none"
2508    )]
2509    pub lot_number: Option<String>,
2510    #[serde(rename = "@ID")]
2511    pub id: String,
2512    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
2513    pub power: Option<f32>,
2514    #[serde(
2515        default = "LightEmittingDiode::default_power_unit",
2516        rename = "@PowerUnit"
2517    )]
2518    pub power_unit: UnitsPower,
2519    #[serde(
2520        default,
2521        rename = "AnnotationRef",
2522        skip_serializing_if = "Vec::is_empty"
2523    )]
2524    pub annotation_ref: Vec<AnnotationRef>,
2525}
2526impl LightEmittingDiode {
2527    pub fn default_power_unit() -> UnitsPower {
2528        UnitsPower::mW
2529    }
2530}
2531impl Default for LightEmittingDiode {
2532    fn default() -> Self {
2533        Self {
2534            manufacturer: None,
2535            model: None,
2536            serial_number: None,
2537            lot_number: None,
2538            id: String::new(),
2539            power: None,
2540            power_unit: Self::default_power_unit(),
2541            annotation_ref: Vec::new(),
2542        }
2543    }
2544}
2545#[cfg_attr(
2546    feature = "python",
2547    pyclass(
2548        module = "ome_metadata",
2549        skip_from_py_object,
2550        get_all,
2551        set_all,
2552        eq,
2553        new = "from_fields"
2554    ),
2555    derive(FromPyObject, PyOme)
2556)]
2557#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2558pub struct LightPath {
2559    #[serde(
2560        default,
2561        rename = "ExcitationFilterRef",
2562        skip_serializing_if = "Vec::is_empty"
2563    )]
2564    pub excitation_filter_ref: Vec<AnnotationRef>,
2565    #[serde(
2566        default,
2567        rename = "DichroicRef",
2568        skip_serializing_if = "Option::is_none"
2569    )]
2570    pub dichroic_ref: Option<AnnotationRef>,
2571    #[serde(
2572        default,
2573        rename = "EmissionFilterRef",
2574        skip_serializing_if = "Vec::is_empty"
2575    )]
2576    pub emission_filter_ref: Vec<AnnotationRef>,
2577    #[serde(
2578        default,
2579        rename = "AnnotationRef",
2580        skip_serializing_if = "Vec::is_empty"
2581    )]
2582    pub annotation_ref: Vec<AnnotationRef>,
2583}
2584#[cfg_attr(
2585    feature = "python",
2586    pyclass(
2587        module = "ome_metadata",
2588        skip_from_py_object,
2589        get_all,
2590        set_all,
2591        eq,
2592        new = "from_fields"
2593    ),
2594    derive(FromPyObject, PyOme)
2595)]
2596#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2597pub struct LightSourceType {
2598    #[serde(
2599        default,
2600        rename = "@Manufacturer",
2601        skip_serializing_if = "Option::is_none"
2602    )]
2603    pub manufacturer: Option<String>,
2604    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
2605    pub model: Option<String>,
2606    #[serde(
2607        default,
2608        rename = "@SerialNumber",
2609        skip_serializing_if = "Option::is_none"
2610    )]
2611    pub serial_number: Option<String>,
2612    #[serde(
2613        default,
2614        rename = "@LotNumber",
2615        skip_serializing_if = "Option::is_none"
2616    )]
2617    pub lot_number: Option<String>,
2618    #[serde(rename = "@ID")]
2619    pub id: String,
2620    #[serde(default, rename = "@Power", skip_serializing_if = "Option::is_none")]
2621    pub power: Option<f32>,
2622    #[serde(default = "LightSourceType::default_power_unit", rename = "@PowerUnit")]
2623    pub power_unit: UnitsPower,
2624    #[serde(
2625        default,
2626        rename = "AnnotationRef",
2627        skip_serializing_if = "Vec::is_empty"
2628    )]
2629    pub annotation_ref: Vec<AnnotationRef>,
2630}
2631impl LightSourceType {
2632    pub fn default_power_unit() -> UnitsPower {
2633        UnitsPower::mW
2634    }
2635}
2636impl Default for LightSourceType {
2637    fn default() -> Self {
2638        Self {
2639            manufacturer: None,
2640            model: None,
2641            serial_number: None,
2642            lot_number: None,
2643            id: String::new(),
2644            power: None,
2645            power_unit: Self::default_power_unit(),
2646            annotation_ref: Vec::new(),
2647        }
2648    }
2649}
2650#[derive(
2651    EnumString,
2652    AsRefStr,
2653    Debug,
2654    strum::Display,
2655    Clone,
2656    PartialEq,
2657    Deserialize,
2658    Serialize,
2659    VariantNames,
2660    OmeXML,
2661)]
2662#[strum(ascii_case_insensitive)]
2663#[cfg_attr(
2664    feature = "python",
2665    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
2666    derive(PyOmeComplexEnum)
2667)]
2668pub enum LightSourceGroup {
2669    #[serde(rename = "Laser", alias = "Laser")]
2670    Laser(Laser),
2671    #[serde(rename = "Arc", alias = "Arc")]
2672    Arc(Arc),
2673    #[serde(rename = "Filament", alias = "Filament")]
2674    Filament(Filament),
2675    #[serde(rename = "LightEmittingDiode", alias = "LightEmittingDiode")]
2676    LightEmittingDiode(LightEmittingDiode),
2677    #[serde(rename = "GenericExcitationSource", alias = "GenericExcitationSource")]
2678    GenericExcitationSource(GenericExcitationSource),
2679}
2680#[cfg_attr(
2681    feature = "python",
2682    pyclass(
2683        module = "ome_metadata",
2684        skip_from_py_object,
2685        get_all,
2686        set_all,
2687        eq,
2688        new = "from_fields"
2689    ),
2690    derive(FromPyObject, PyOme)
2691)]
2692#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2693pub struct LightSourceSettings {
2694    #[serde(rename = "@ID")]
2695    pub id: String,
2696    #[serde(
2697        default,
2698        rename = "@Attenuation",
2699        skip_serializing_if = "Option::is_none"
2700    )]
2701    pub attenuation: Option<f32>,
2702    #[serde(
2703        default,
2704        rename = "@Wavelength",
2705        skip_serializing_if = "Option::is_none"
2706    )]
2707    pub wavelength: Option<f32>,
2708    #[serde(
2709        default = "LightSourceSettings::default_wavelength_unit",
2710        rename = "@WavelengthUnit"
2711    )]
2712    pub wavelength_unit: UnitsLength,
2713}
2714impl LightSourceSettings {
2715    pub fn default_wavelength_unit() -> UnitsLength {
2716        UnitsLength::nm
2717    }
2718}
2719impl Default for LightSourceSettings {
2720    fn default() -> Self {
2721        Self {
2722            id: String::new(),
2723            attenuation: None,
2724            wavelength: None,
2725            wavelength_unit: Self::default_wavelength_unit(),
2726        }
2727    }
2728}
2729#[cfg_attr(
2730    feature = "python",
2731    pyclass(
2732        module = "ome_metadata",
2733        skip_from_py_object,
2734        get_all,
2735        set_all,
2736        eq,
2737        new = "from_fields"
2738    ),
2739    derive(FromPyObject, PyOme)
2740)]
2741#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
2742pub struct Line {
2743    #[serde(
2744        default,
2745        rename = "@FillColor",
2746        skip_serializing_if = "Option::is_none"
2747    )]
2748    pub fill_color: Option<i32>,
2749    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
2750    pub fill_rule: Option<ShapeFillRuleType>,
2751    #[serde(
2752        default,
2753        rename = "@StrokeColor",
2754        skip_serializing_if = "Option::is_none"
2755    )]
2756    pub stroke_color: Option<i32>,
2757    #[serde(
2758        default,
2759        rename = "@StrokeWidth",
2760        skip_serializing_if = "Option::is_none"
2761    )]
2762    pub stroke_width: Option<f32>,
2763    #[serde(
2764        default = "Line::default_stroke_width_unit",
2765        rename = "@StrokeWidthUnit"
2766    )]
2767    pub stroke_width_unit: UnitsLength,
2768    #[serde(
2769        default,
2770        rename = "@StrokeDashArray",
2771        skip_serializing_if = "Option::is_none"
2772    )]
2773    pub stroke_dash_array: Option<String>,
2774    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
2775    pub text: Option<String>,
2776    #[serde(
2777        default,
2778        rename = "@FontFamily",
2779        skip_serializing_if = "Option::is_none"
2780    )]
2781    pub font_family: Option<FontFamilyType>,
2782    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
2783    pub font_size: Option<i32>,
2784    #[serde(default = "Line::default_font_size_unit", rename = "@FontSizeUnit")]
2785    pub font_size_unit: UnitsLength,
2786    #[serde(
2787        default,
2788        rename = "@FontStyle",
2789        skip_serializing_if = "Option::is_none"
2790    )]
2791    pub font_style: Option<ShapeFontStyleType>,
2792    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
2793    pub locked: Option<bool>,
2794    #[serde(rename = "@ID")]
2795    pub id: String,
2796    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
2797    pub the_z: Option<i32>,
2798    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
2799    pub the_t: Option<i32>,
2800    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
2801    pub the_c: Option<i32>,
2802    #[serde(rename = "@X1")]
2803    pub x1: f32,
2804    #[serde(rename = "@Y1")]
2805    pub y1: f32,
2806    #[serde(rename = "@X2")]
2807    pub x2: f32,
2808    #[serde(rename = "@Y2")]
2809    pub y2: f32,
2810    #[serde(
2811        default,
2812        rename = "@MarkerStart",
2813        skip_serializing_if = "Option::is_none"
2814    )]
2815    pub marker_start: Option<MarkerType>,
2816    #[serde(
2817        default,
2818        rename = "@MarkerEnd",
2819        skip_serializing_if = "Option::is_none"
2820    )]
2821    pub marker_end: Option<MarkerType>,
2822    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
2823    pub transform: Option<AffineTransform>,
2824    #[serde(
2825        default,
2826        rename = "AnnotationRef",
2827        skip_serializing_if = "Vec::is_empty"
2828    )]
2829    pub annotation_ref: Vec<AnnotationRef>,
2830}
2831impl Line {
2832    pub fn default_stroke_width_unit() -> UnitsLength {
2833        UnitsLength::Pixel
2834    }
2835    pub fn default_font_size_unit() -> UnitsLength {
2836        UnitsLength::Pixel
2837    }
2838}
2839impl Default for Line {
2840    fn default() -> Self {
2841        Self {
2842            fill_color: None,
2843            fill_rule: None,
2844            stroke_color: None,
2845            stroke_width: None,
2846            stroke_width_unit: Self::default_stroke_width_unit(),
2847            stroke_dash_array: None,
2848            text: None,
2849            font_family: None,
2850            font_size: None,
2851            font_size_unit: Self::default_font_size_unit(),
2852            font_style: None,
2853            locked: None,
2854            id: String::new(),
2855            the_z: None,
2856            the_c: None,
2857            the_t: None,
2858            x1: 0.0,
2859            y1: 0.0,
2860            x2: 0.0,
2861            y2: 0.0,
2862            marker_start: None,
2863            marker_end: None,
2864            transform: None,
2865            annotation_ref: Vec::new(),
2866        }
2867    }
2868}
2869#[cfg_attr(
2870    feature = "python",
2871    pyclass(
2872        module = "ome_metadata",
2873        skip_from_py_object,
2874        get_all,
2875        set_all,
2876        eq,
2877        new = "from_fields"
2878    ),
2879    derive(FromPyObject, PyOme)
2880)]
2881#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2882pub struct LongAnnotation {
2883    #[serde(rename = "@ID")]
2884    pub id: String,
2885    #[serde(
2886        default,
2887        rename = "@Namespace",
2888        skip_serializing_if = "Option::is_none"
2889    )]
2890    pub namespace: Option<String>,
2891    #[serde(
2892        default,
2893        rename = "@Annotator",
2894        skip_serializing_if = "Option::is_none"
2895    )]
2896    pub annotator: Option<String>,
2897    #[serde(
2898        default,
2899        rename = "Description",
2900        skip_serializing_if = "Option::is_none"
2901    )]
2902    pub description: Option<String>,
2903    #[serde(
2904        default,
2905        rename = "AnnotationRef",
2906        skip_serializing_if = "Vec::is_empty"
2907    )]
2908    pub annotation_ref: Vec<AnnotationRef>,
2909    #[serde(rename = "Value")]
2910    pub value: i64,
2911}
2912#[cfg_attr(
2913    feature = "python",
2914    pyclass(
2915        module = "ome_metadata",
2916        skip_from_py_object,
2917        get_all,
2918        set_all,
2919        eq,
2920        new = "from_fields"
2921    ),
2922    derive(FromPyObject, PyOme)
2923)]
2924#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2925pub struct MapType {
2926    #[serde(default, rename = "M", skip_serializing_if = "Vec::is_empty")]
2927    pub m: Vec<MapM>,
2928}
2929#[cfg_attr(
2930    feature = "python",
2931    pyclass(
2932        module = "ome_metadata",
2933        skip_from_py_object,
2934        get_all,
2935        set_all,
2936        eq,
2937        new = "from_fields"
2938    ),
2939    derive(FromPyObject, PyOme)
2940)]
2941#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2942pub struct MapAnnotation {
2943    #[serde(rename = "@ID")]
2944    pub id: String,
2945    #[serde(
2946        default,
2947        rename = "@Namespace",
2948        skip_serializing_if = "Option::is_none"
2949    )]
2950    pub namespace: Option<String>,
2951    #[serde(
2952        default,
2953        rename = "@Annotator",
2954        skip_serializing_if = "Option::is_none"
2955    )]
2956    pub annotator: Option<String>,
2957    #[serde(
2958        default,
2959        rename = "Description",
2960        skip_serializing_if = "Option::is_none"
2961    )]
2962    pub description: Option<String>,
2963    #[serde(
2964        default,
2965        rename = "AnnotationRef",
2966        skip_serializing_if = "Vec::is_empty"
2967    )]
2968    pub annotation_ref: Vec<AnnotationRef>,
2969    #[serde(rename = "Value")]
2970    pub value: MapType,
2971}
2972#[cfg_attr(
2973    feature = "python",
2974    pyclass(
2975        module = "ome_metadata",
2976        skip_from_py_object,
2977        get_all,
2978        set_all,
2979        eq,
2980        new = "from_fields"
2981    ),
2982    derive(FromPyObject, PyOme)
2983)]
2984#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
2985pub struct MapM {
2986    #[serde(default, rename = "@K", skip_serializing_if = "Option::is_none")]
2987    pub k: Option<String>,
2988    #[serde(rename = "$text")]
2989    pub content: String,
2990}
2991#[derive(
2992    EnumString,
2993    AsRefStr,
2994    Debug,
2995    strum::Display,
2996    Clone,
2997    Copy,
2998    PartialEq,
2999    Eq,
3000    PartialOrd,
3001    Ord,
3002    Hash,
3003    Deserialize,
3004    Serialize,
3005    VariantNames,
3006    OmeXML,
3007)]
3008#[strum(ascii_case_insensitive)]
3009#[cfg_attr(
3010    feature = "python",
3011    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3012    derive(PyOmeEnum)
3013)]
3014pub enum MarkerType {
3015    #[serde(rename = "Arrow")]
3016    Arrow,
3017}
3018#[cfg_attr(
3019    feature = "python",
3020    pyclass(
3021        module = "ome_metadata",
3022        skip_from_py_object,
3023        get_all,
3024        set_all,
3025        eq,
3026        new = "from_fields"
3027    ),
3028    derive(FromPyObject, PyOme)
3029)]
3030#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
3031pub struct Mask {
3032    #[serde(
3033        default,
3034        rename = "@FillColor",
3035        skip_serializing_if = "Option::is_none"
3036    )]
3037    pub fill_color: Option<i32>,
3038    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
3039    pub fill_rule: Option<ShapeFillRuleType>,
3040    #[serde(
3041        default,
3042        rename = "@StrokeColor",
3043        skip_serializing_if = "Option::is_none"
3044    )]
3045    pub stroke_color: Option<i32>,
3046    #[serde(
3047        default,
3048        rename = "@StrokeWidth",
3049        skip_serializing_if = "Option::is_none"
3050    )]
3051    pub stroke_width: Option<f32>,
3052    #[serde(
3053        default = "Mask::default_stroke_width_unit",
3054        rename = "@StrokeWidthUnit"
3055    )]
3056    pub stroke_width_unit: UnitsLength,
3057    #[serde(
3058        default,
3059        rename = "@StrokeDashArray",
3060        skip_serializing_if = "Option::is_none"
3061    )]
3062    pub stroke_dash_array: Option<String>,
3063    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
3064    pub text: Option<String>,
3065    #[serde(
3066        default,
3067        rename = "@FontFamily",
3068        skip_serializing_if = "Option::is_none"
3069    )]
3070    pub font_family: Option<FontFamilyType>,
3071    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
3072    pub font_size: Option<i32>,
3073    #[serde(default = "Mask::default_font_size_unit", rename = "@FontSizeUnit")]
3074    pub font_size_unit: UnitsLength,
3075    #[serde(
3076        default,
3077        rename = "@FontStyle",
3078        skip_serializing_if = "Option::is_none"
3079    )]
3080    pub font_style: Option<ShapeFontStyleType>,
3081    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
3082    pub locked: Option<bool>,
3083    #[serde(rename = "@ID")]
3084    pub id: String,
3085    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
3086    pub the_z: Option<i32>,
3087    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
3088    pub the_t: Option<i32>,
3089    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
3090    pub the_c: Option<i32>,
3091    #[serde(rename = "@X")]
3092    pub x: f32,
3093    #[serde(rename = "@Y")]
3094    pub y: f32,
3095    #[serde(rename = "@Width")]
3096    pub width: f32,
3097    #[serde(rename = "@Height")]
3098    pub height: f32,
3099    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
3100    pub transform: Option<AffineTransform>,
3101    #[serde(
3102        default,
3103        rename = "AnnotationRef",
3104        skip_serializing_if = "Vec::is_empty"
3105    )]
3106    pub annotation_ref: Vec<AnnotationRef>,
3107    #[serde(rename = "BinData")]
3108    pub bin_data: BinData,
3109}
3110impl Mask {
3111    pub fn default_stroke_width_unit() -> UnitsLength {
3112        UnitsLength::Pixel
3113    }
3114    pub fn default_font_size_unit() -> UnitsLength {
3115        UnitsLength::Pixel
3116    }
3117}
3118#[cfg_attr(
3119    feature = "python",
3120    pyclass(module = "ome_metadata", skip_from_py_object, eq, new = "from_fields")
3121)]
3122#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3123pub struct MetadataOnly;
3124#[cfg_attr(
3125    feature = "python",
3126    pyclass(
3127        module = "ome_metadata",
3128        skip_from_py_object,
3129        get_all,
3130        set_all,
3131        eq,
3132        new = "from_fields"
3133    ),
3134    derive(FromPyObject, PyOme)
3135)]
3136#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3137pub struct MicrobeamManipulation {
3138    #[serde(rename = "@ID")]
3139    pub id: String,
3140    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
3141    pub r#type: Option<MicrobeamManipulationType>,
3142    #[serde(
3143        default,
3144        rename = "Description",
3145        skip_serializing_if = "Option::is_none"
3146    )]
3147    pub description: Option<String>,
3148    #[serde(default, rename = "ROIRef", skip_serializing_if = "Vec::is_empty")]
3149    pub roi_ref: Vec<AnnotationRef>,
3150    #[serde(rename = "ExperimenterRef")]
3151    pub experimenter_ref: AnnotationRef,
3152    #[serde(
3153        default,
3154        rename = "LightSourceSettings",
3155        skip_serializing_if = "Vec::is_empty"
3156    )]
3157    pub light_source_settings: Vec<LightSourceSettings>,
3158}
3159#[derive(
3160    EnumString,
3161    AsRefStr,
3162    Debug,
3163    strum::Display,
3164    Clone,
3165    Copy,
3166    PartialEq,
3167    Eq,
3168    PartialOrd,
3169    Ord,
3170    Hash,
3171    Deserialize,
3172    Serialize,
3173    VariantNames,
3174    OmeXML,
3175)]
3176#[strum(ascii_case_insensitive)]
3177#[cfg_attr(
3178    feature = "python",
3179    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3180    derive(PyOmeEnum)
3181)]
3182pub enum MicrobeamManipulationItemType {
3183    #[serde(rename = "FRAP")]
3184    Frap,
3185    #[serde(rename = "FLIP")]
3186    Flip,
3187    #[serde(rename = "InverseFRAP")]
3188    InverseFrap,
3189    #[serde(rename = "Photoablation")]
3190    Photoablation,
3191    #[serde(rename = "Photoactivation")]
3192    Photoactivation,
3193    #[serde(rename = "Uncaging")]
3194    Uncaging,
3195    #[serde(rename = "OpticalTrapping")]
3196    OpticalTrapping,
3197    #[serde(rename = "Other")]
3198    Other,
3199}
3200#[cfg_attr(
3201    feature = "python",
3202    pyclass(module = "ome_metadata", skip_from_py_object, eq, new = "from_fields"),
3203    derive(FromPyObject)
3204)]
3205#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3206pub struct MicrobeamManipulationType(pub Vec<MicrobeamManipulationItemType>);
3207#[cfg_attr(
3208    feature = "python",
3209    pyclass(
3210        module = "ome_metadata",
3211        skip_from_py_object,
3212        get_all,
3213        set_all,
3214        eq,
3215        new = "from_fields"
3216    ),
3217    derive(FromPyObject, PyOme)
3218)]
3219#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3220pub struct Microscope {
3221    #[serde(
3222        default,
3223        rename = "@Manufacturer",
3224        skip_serializing_if = "Option::is_none"
3225    )]
3226    pub manufacturer: Option<String>,
3227    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
3228    pub model: Option<String>,
3229    #[serde(
3230        default,
3231        rename = "@SerialNumber",
3232        skip_serializing_if = "Option::is_none"
3233    )]
3234    pub serial_number: Option<String>,
3235    #[serde(
3236        default,
3237        rename = "@LotNumber",
3238        skip_serializing_if = "Option::is_none"
3239    )]
3240    pub lot_number: Option<String>,
3241    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
3242    pub r#type: Option<MicroscopeType>,
3243}
3244#[derive(
3245    EnumString,
3246    AsRefStr,
3247    Debug,
3248    strum::Display,
3249    Clone,
3250    Copy,
3251    PartialEq,
3252    Eq,
3253    PartialOrd,
3254    Ord,
3255    Hash,
3256    Deserialize,
3257    Serialize,
3258    VariantNames,
3259    OmeXML,
3260)]
3261#[strum(ascii_case_insensitive)]
3262#[cfg_attr(
3263    feature = "python",
3264    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3265    derive(PyOmeEnum)
3266)]
3267pub enum MicroscopeType {
3268    #[serde(rename = "Upright")]
3269    Upright,
3270    #[serde(rename = "Inverted")]
3271    Inverted,
3272    #[serde(rename = "Dissection")]
3273    Dissection,
3274    #[serde(rename = "Electrophysiology")]
3275    Electrophysiology,
3276    #[serde(rename = "Other")]
3277    Other,
3278}
3279#[derive(
3280    EnumString,
3281    AsRefStr,
3282    Debug,
3283    strum::Display,
3284    Clone,
3285    Copy,
3286    PartialEq,
3287    Eq,
3288    PartialOrd,
3289    Ord,
3290    Hash,
3291    Deserialize,
3292    Serialize,
3293    VariantNames,
3294    OmeXML,
3295)]
3296#[strum(ascii_case_insensitive)]
3297#[cfg_attr(
3298    feature = "python",
3299    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3300    derive(PyOmeEnum)
3301)]
3302pub enum NamingConventionType {
3303    #[serde(rename = "letter")]
3304    Letter,
3305    #[serde(rename = "number")]
3306    Number,
3307}
3308
3309/// The root of the metadata, create this by parsing an XML string.
3310/// ```
3311/// use ome_metadata::Ome;
3312///
3313/// let xml = r#"<OME xmlns="https://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.openmicroscopy.org/Schemas/OME/2016-06 https://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd">
3314///   <Image ID="Image:0" Name="test.tif">
3315///     <AcquisitionDate>2025-01-29T14:42:42</AcquisitionDate>
3316///     <Description/>
3317///     <Pixels ID="Pixels:0" DimensionOrder="XYCZT" Type="int8" SignificantBits="8" Interleaved="false" BigEndian="false" SizeX="2" SizeY="2" SizeZ="1" SizeC="1" SizeT="1">
3318///       <Channel ID="Channel:0:0" SamplesPerPixel="1">
3319///         <LightPath/>
3320///       </Channel>
3321///       <MetadataOnly/>
3322///     </Pixels>
3323///   </Image>
3324/// </OME>"#;
3325///
3326/// let ome =  Ome::from_xml(xml).unwrap();
3327/// let image = &ome.image[0];
3328/// println!("acquisition date: {:#?}", image.acquisition_date);
3329/// ```
3330
3331#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq)]
3332#[cfg_attr(
3333    feature = "python",
3334    pyclass(
3335        module = "ome_metadata",
3336        skip_from_py_object,
3337        get_all,
3338        set_all,
3339        eq,
3340        new = "from_fields"
3341    ),
3342    derive(FromPyObject, PyOme)
3343)]
3344pub struct Ome {
3345    #[serde(default, rename = "@UUID", skip_serializing_if = "Option::is_none")]
3346    pub uuid: Option<String>,
3347    #[serde(default, rename = "@Creator", skip_serializing_if = "Option::is_none")]
3348    pub creator: Option<String>,
3349    #[serde(rename = "Rights", skip_serializing_if = "Option::is_none")]
3350    pub rights: Option<Rights>,
3351    #[serde(default, rename = "Project", skip_serializing_if = "Vec::is_empty")]
3352    pub project: Vec<Project>,
3353    #[serde(default, rename = "Dataset", skip_serializing_if = "Vec::is_empty")]
3354    pub dataset: Vec<Dataset>,
3355    #[serde(default, rename = "Folder", skip_serializing_if = "Vec::is_empty")]
3356    pub folder: Vec<Folder>,
3357    #[serde(default, rename = "Experiment", skip_serializing_if = "Vec::is_empty")]
3358    pub experiment: Vec<Experiment>,
3359    #[serde(default, rename = "Plate", skip_serializing_if = "Vec::is_empty")]
3360    pub plate: Vec<Plate>,
3361    #[serde(default, rename = "Screen", skip_serializing_if = "Vec::is_empty")]
3362    pub screen: Vec<Screen>,
3363    #[serde(
3364        default,
3365        rename = "Experimenter",
3366        skip_serializing_if = "Vec::is_empty"
3367    )]
3368    pub experimenter: Vec<Experimenter>,
3369    #[serde(
3370        default,
3371        rename = "ExperimenterGroup",
3372        skip_serializing_if = "Vec::is_empty"
3373    )]
3374    pub experimenter_group: Vec<ExperimenterGroup>,
3375    #[serde(default, rename = "Instrument", skip_serializing_if = "Vec::is_empty")]
3376    pub instrument: Vec<Instrument>,
3377    #[serde(default, rename = "Image", skip_serializing_if = "Vec::is_empty")]
3378    pub image: Vec<Image>,
3379    #[serde(
3380        rename = "StructuredAnnotations",
3381        skip_serializing_if = "Option::is_none"
3382    )]
3383    pub structured_annotations: Option<StructuredAnnotations>,
3384    #[serde(default, rename = "ROI", skip_serializing_if = "Vec::is_empty")]
3385    pub roi: Vec<Roi>,
3386    #[serde(rename = "BinaryOnly", skip_serializing_if = "Option::is_none")]
3387    pub binary_only: Option<OmeBinaryOnly>,
3388}
3389impl Ome {
3390    pub fn from_xml<T: AsRef<str>>(s: T) -> Result<Self, Error> {
3391        Ok(from_str(s.as_ref())?)
3392    }
3393
3394    pub fn to_xml(&self) -> Result<String, Error> {
3395        Ok(to_string(self)?.replace("<Ome>", r###"<OME xmlns="https://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.openmicroscopy.org/Schemas/OME/2016-06 https://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd">"###).replace("</Ome>", "</OME>"))
3396    }
3397}
3398#[cfg_attr(
3399    feature = "python",
3400    pyclass(
3401        module = "ome_metadata",
3402        skip_from_py_object,
3403        get_all,
3404        set_all,
3405        eq,
3406        new = "from_fields"
3407    ),
3408    derive(FromPyObject, PyOme)
3409)]
3410#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
3411pub struct Objective {
3412    #[serde(
3413        default,
3414        rename = "@Manufacturer",
3415        skip_serializing_if = "Option::is_none"
3416    )]
3417    pub manufacturer: Option<String>,
3418    #[serde(default, rename = "@Model", skip_serializing_if = "Option::is_none")]
3419    pub model: Option<String>,
3420    #[serde(
3421        default,
3422        rename = "@SerialNumber",
3423        skip_serializing_if = "Option::is_none"
3424    )]
3425    pub serial_number: Option<String>,
3426    #[serde(
3427        default,
3428        rename = "@LotNumber",
3429        skip_serializing_if = "Option::is_none"
3430    )]
3431    pub lot_number: Option<String>,
3432    #[serde(rename = "@ID")]
3433    pub id: String,
3434    #[serde(
3435        default,
3436        rename = "@Correction",
3437        skip_serializing_if = "Option::is_none"
3438    )]
3439    pub correction: Option<ObjectiveCorrectionType>,
3440    #[serde(
3441        default,
3442        rename = "@Immersion",
3443        skip_serializing_if = "Option::is_none"
3444    )]
3445    pub immersion: Option<ObjectiveImmersionType>,
3446    #[serde(default, rename = "@LensNA", skip_serializing_if = "Option::is_none")]
3447    pub lens_na: Option<f32>,
3448    #[serde(
3449        default,
3450        rename = "@NominalMagnification",
3451        skip_serializing_if = "Option::is_none"
3452    )]
3453    pub nominal_magnification: Option<f32>,
3454    #[serde(
3455        default,
3456        rename = "@CalibratedMagnification",
3457        skip_serializing_if = "Option::is_none"
3458    )]
3459    pub calibrated_magnification: Option<f32>,
3460    #[serde(
3461        default,
3462        rename = "@WorkingDistance",
3463        skip_serializing_if = "Option::is_none"
3464    )]
3465    pub working_distance: Option<f32>,
3466    #[serde(
3467        default = "Objective::default_working_distance_unit",
3468        rename = "@WorkingDistanceUnit"
3469    )]
3470    pub working_distance_unit: UnitsLength,
3471    #[serde(default, rename = "@Iris", skip_serializing_if = "Option::is_none")]
3472    pub iris: Option<bool>,
3473    #[serde(
3474        default,
3475        rename = "AnnotationRef",
3476        skip_serializing_if = "Vec::is_empty"
3477    )]
3478    pub annotation_ref: Vec<AnnotationRef>,
3479}
3480impl Objective {
3481    pub fn default_working_distance_unit() -> UnitsLength {
3482        UnitsLength::um
3483    }
3484}
3485impl Default for Objective {
3486    fn default() -> Self {
3487        Self {
3488            manufacturer: None,
3489            model: None,
3490            serial_number: None,
3491            lot_number: None,
3492            id: String::new(),
3493            correction: None,
3494            immersion: None,
3495            lens_na: None,
3496            nominal_magnification: None,
3497            calibrated_magnification: None,
3498            working_distance: None,
3499            working_distance_unit: Self::default_working_distance_unit(),
3500            iris: None,
3501            annotation_ref: Vec::new(),
3502        }
3503    }
3504}
3505#[derive(
3506    EnumString,
3507    AsRefStr,
3508    Debug,
3509    strum::Display,
3510    Clone,
3511    Copy,
3512    PartialEq,
3513    Eq,
3514    PartialOrd,
3515    Ord,
3516    Hash,
3517    Deserialize,
3518    Serialize,
3519    VariantNames,
3520    OmeXML,
3521)]
3522#[strum(ascii_case_insensitive)]
3523#[cfg_attr(
3524    feature = "python",
3525    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3526    derive(PyOmeEnum)
3527)]
3528pub enum ObjectiveCorrectionType {
3529    #[serde(rename = "UV")]
3530    Uv,
3531    #[serde(rename = "PlanApo")]
3532    PlanApo,
3533    #[serde(rename = "PlanFluor")]
3534    PlanFluor,
3535    #[serde(rename = "SuperFluor")]
3536    SuperFluor,
3537    #[serde(rename = "VioletCorrected")]
3538    VioletCorrected,
3539    #[serde(rename = "Achro")]
3540    Achro,
3541    #[serde(rename = "Achromat")]
3542    Achromat,
3543    #[serde(rename = "Fluor")]
3544    Fluor,
3545    #[serde(rename = "Fl")]
3546    Fl,
3547    #[serde(rename = "Fluar")]
3548    Fluar,
3549    #[serde(rename = "Neofluar")]
3550    Neofluar,
3551    #[serde(rename = "Fluotar")]
3552    Fluotar,
3553    #[serde(rename = "Apo")]
3554    Apo,
3555    #[serde(rename = "PlanNeofluar")]
3556    PlanNeofluar,
3557    #[serde(rename = "Other")]
3558    Other,
3559}
3560#[derive(
3561    EnumString,
3562    AsRefStr,
3563    Debug,
3564    strum::Display,
3565    Clone,
3566    Copy,
3567    PartialEq,
3568    Eq,
3569    PartialOrd,
3570    Ord,
3571    Hash,
3572    Deserialize,
3573    Serialize,
3574    VariantNames,
3575    OmeXML,
3576)]
3577#[strum(ascii_case_insensitive)]
3578#[cfg_attr(
3579    feature = "python",
3580    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3581    derive(PyOmeEnum)
3582)]
3583pub enum ObjectiveImmersionType {
3584    #[serde(rename = "Oil")]
3585    Oil,
3586    #[serde(rename = "Water")]
3587    Water,
3588    #[serde(rename = "WaterDipping")]
3589    WaterDipping,
3590    #[serde(rename = "Air")]
3591    Air,
3592    #[serde(rename = "Multi")]
3593    Multi,
3594    #[serde(rename = "Glycerol")]
3595    Glycerol,
3596    #[serde(rename = "Other")]
3597    Other,
3598}
3599#[cfg_attr(
3600    feature = "python",
3601    pyclass(
3602        module = "ome_metadata",
3603        skip_from_py_object,
3604        get_all,
3605        set_all,
3606        eq,
3607        new = "from_fields"
3608    ),
3609    derive(FromPyObject, PyOme)
3610)]
3611#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3612pub struct ObjectiveSettings {
3613    #[serde(rename = "@ID")]
3614    pub id: String,
3615    #[serde(
3616        default,
3617        rename = "@CorrectionCollar",
3618        skip_serializing_if = "Option::is_none"
3619    )]
3620    pub correction_collar: Option<f32>,
3621    #[serde(default, rename = "@Medium", skip_serializing_if = "Option::is_none")]
3622    pub medium: Option<ObjectiveSettingsMediumType>,
3623    #[serde(
3624        default,
3625        rename = "@RefractiveIndex",
3626        skip_serializing_if = "Option::is_none"
3627    )]
3628    pub refractive_index: Option<f32>,
3629}
3630#[derive(
3631    EnumString,
3632    AsRefStr,
3633    Debug,
3634    strum::Display,
3635    Clone,
3636    Copy,
3637    PartialEq,
3638    Eq,
3639    PartialOrd,
3640    Ord,
3641    Hash,
3642    Deserialize,
3643    Serialize,
3644    VariantNames,
3645    OmeXML,
3646)]
3647#[strum(ascii_case_insensitive)]
3648#[cfg_attr(
3649    feature = "python",
3650    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3651    derive(PyOmeEnum)
3652)]
3653pub enum ObjectiveSettingsMediumType {
3654    #[serde(rename = "Air")]
3655    Air,
3656    #[serde(rename = "Oil")]
3657    Oil,
3658    #[serde(rename = "Water")]
3659    Water,
3660    #[serde(rename = "Glycerol")]
3661    Glycerol,
3662    #[serde(rename = "Other")]
3663    Other,
3664}
3665#[cfg_attr(
3666    feature = "python",
3667    pyclass(
3668        module = "ome_metadata",
3669        skip_from_py_object,
3670        get_all,
3671        set_all,
3672        eq,
3673        new = "from_fields"
3674    ),
3675    derive(FromPyObject, PyOme)
3676)]
3677#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
3678pub struct OmeBinaryOnly {
3679    #[serde(rename = "@MetadataFile")]
3680    pub metadata_file: String,
3681    #[serde(rename = "@UUID")]
3682    pub uuid: String,
3683}
3684#[derive(
3685    EnumString,
3686    AsRefStr,
3687    Debug,
3688    strum::Display,
3689    Clone,
3690    Copy,
3691    PartialEq,
3692    Eq,
3693    PartialOrd,
3694    Ord,
3695    Hash,
3696    Deserialize,
3697    Serialize,
3698    VariantNames,
3699    OmeXML,
3700)]
3701#[strum(ascii_case_insensitive)]
3702#[cfg_attr(
3703    feature = "python",
3704    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3705    derive(PyOmeEnum)
3706)]
3707pub enum PixelType {
3708    #[serde(rename = "int8")]
3709    Int8,
3710    #[serde(rename = "int16")]
3711    Int16,
3712    #[serde(rename = "int32")]
3713    Int32,
3714    #[serde(rename = "uint8")]
3715    Uint8,
3716    #[serde(rename = "uint16")]
3717    Uint16,
3718    #[serde(rename = "uint32")]
3719    Uint32,
3720    #[serde(rename = "float")]
3721    Float,
3722    #[serde(rename = "double")]
3723    Double,
3724    #[serde(rename = "complex")]
3725    Complex,
3726    #[serde(rename = "double-complex")]
3727    DoubleComplex,
3728    #[serde(rename = "bit")]
3729    Bit,
3730}
3731#[cfg_attr(
3732    feature = "python",
3733    pyclass(
3734        module = "ome_metadata",
3735        skip_from_py_object,
3736        get_all,
3737        set_all,
3738        eq,
3739        new = "from_fields"
3740    ),
3741    derive(FromPyObject, PyOme)
3742)]
3743#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
3744pub struct Pixels {
3745    #[serde(rename = "@ID")]
3746    pub id: String,
3747    #[serde(rename = "@DimensionOrder")]
3748    pub dimension_order: PixelsDimensionOrderType,
3749    #[serde(rename = "@Type")]
3750    pub r#type: PixelType,
3751    #[serde(
3752        default,
3753        rename = "@SignificantBits",
3754        skip_serializing_if = "Option::is_none"
3755    )]
3756    pub significant_bits: Option<i32>,
3757    #[serde(
3758        default,
3759        rename = "@Interleaved",
3760        skip_serializing_if = "Option::is_none"
3761    )]
3762    pub interleaved: Option<bool>,
3763    #[serde(
3764        default,
3765        rename = "@BigEndian",
3766        skip_serializing_if = "Option::is_none"
3767    )]
3768    pub big_endian: Option<bool>,
3769    #[serde(rename = "@SizeX")]
3770    pub size_x: i32,
3771    #[serde(rename = "@SizeY")]
3772    pub size_y: i32,
3773    #[serde(rename = "@SizeZ")]
3774    pub size_z: i32,
3775    #[serde(rename = "@SizeC")]
3776    pub size_c: i32,
3777    #[serde(rename = "@SizeT")]
3778    pub size_t: i32,
3779    #[serde(
3780        default,
3781        rename = "@PhysicalSizeX",
3782        skip_serializing_if = "Option::is_none"
3783    )]
3784    pub physical_size_x: Option<f32>,
3785    #[serde(
3786        default = "Pixels::default_physical_size_x_unit",
3787        rename = "@PhysicalSizeXUnit"
3788    )]
3789    pub physical_size_x_unit: UnitsLength,
3790    #[serde(
3791        default,
3792        rename = "@PhysicalSizeY",
3793        skip_serializing_if = "Option::is_none"
3794    )]
3795    pub physical_size_y: Option<f32>,
3796    #[serde(
3797        default = "Pixels::default_physical_size_y_unit",
3798        rename = "@PhysicalSizeYUnit"
3799    )]
3800    pub physical_size_y_unit: UnitsLength,
3801    #[serde(
3802        default,
3803        rename = "@PhysicalSizeZ",
3804        skip_serializing_if = "Option::is_none"
3805    )]
3806    pub physical_size_z: Option<f32>,
3807    #[serde(
3808        default = "Pixels::default_physical_size_z_unit",
3809        rename = "@PhysicalSizeZUnit"
3810    )]
3811    pub physical_size_z_unit: UnitsLength,
3812    #[serde(
3813        default,
3814        rename = "@TimeIncrement",
3815        skip_serializing_if = "Option::is_none"
3816    )]
3817    pub time_increment: Option<f32>,
3818    #[serde(
3819        default = "Pixels::default_time_increment_unit",
3820        rename = "@TimeIncrementUnit"
3821    )]
3822    pub time_increment_unit: UnitsTime,
3823    #[serde(default, rename = "Channel", skip_serializing_if = "Vec::is_empty")]
3824    pub channel: Vec<Channel>,
3825    #[serde(default, rename = "BinData", skip_serializing_if = "Vec::is_empty")]
3826    pub bin_data: Vec<BinData>,
3827    #[serde(default, rename = "TiffData", skip_serializing_if = "Vec::is_empty")]
3828    pub tiff_data: Vec<TiffData>,
3829    #[serde(rename = "MetadataOnly", skip_serializing_if = "Option::is_none")]
3830    pub metadata_only: Option<MetadataOnly>,
3831    #[serde(default, rename = "Plane", skip_serializing_if = "Vec::is_empty")]
3832    pub plane: Vec<Plane>,
3833}
3834impl Pixels {
3835    pub fn default_physical_size_x_unit() -> UnitsLength {
3836        UnitsLength::um
3837    }
3838    pub fn default_physical_size_y_unit() -> UnitsLength {
3839        UnitsLength::um
3840    }
3841    pub fn default_physical_size_z_unit() -> UnitsLength {
3842        UnitsLength::um
3843    }
3844    pub fn default_time_increment_unit() -> UnitsTime {
3845        UnitsTime::s
3846    }
3847}
3848#[derive(
3849    EnumString,
3850    AsRefStr,
3851    Debug,
3852    strum::Display,
3853    Clone,
3854    Copy,
3855    PartialEq,
3856    Eq,
3857    PartialOrd,
3858    Ord,
3859    Hash,
3860    Deserialize,
3861    Serialize,
3862    VariantNames,
3863    OmeXML,
3864)]
3865#[strum(ascii_case_insensitive)]
3866#[cfg_attr(
3867    feature = "python",
3868    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
3869    derive(PyOmeEnum)
3870)]
3871pub enum PixelsDimensionOrderType {
3872    #[serde(rename = "XYZCT")]
3873    Xyzct,
3874    #[serde(rename = "XYZTC")]
3875    Xyztc,
3876    #[serde(rename = "XYCTZ")]
3877    Xyctz,
3878    #[serde(rename = "XYCZT")]
3879    Xyczt,
3880    #[serde(rename = "XYTCZ")]
3881    Xytcz,
3882    #[serde(rename = "XYTZC")]
3883    Xytzc,
3884}
3885#[cfg_attr(
3886    feature = "python",
3887    pyclass(
3888        module = "ome_metadata",
3889        skip_from_py_object,
3890        get_all,
3891        set_all,
3892        eq,
3893        new = "from_fields"
3894    ),
3895    derive(FromPyObject, PyOme)
3896)]
3897#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
3898pub struct Plane {
3899    #[serde(rename = "@TheZ")]
3900    pub the_z: Option<i32>,
3901    #[serde(rename = "@TheT")]
3902    pub the_t: Option<i32>,
3903    #[serde(rename = "@TheC")]
3904    pub the_c: Option<i32>,
3905    #[serde(default, rename = "@DeltaT", skip_serializing_if = "Option::is_none")]
3906    pub delta_t: Option<f32>,
3907    #[serde(default = "Plane::default_delta_t_unit", rename = "@DeltaTUnit")]
3908    pub delta_t_unit: UnitsTime,
3909    #[serde(
3910        default,
3911        rename = "@ExposureTime",
3912        skip_serializing_if = "Option::is_none"
3913    )]
3914    pub exposure_time: Option<f32>,
3915    #[serde(
3916        default = "Plane::default_exposure_time_unit",
3917        rename = "@ExposureTimeUnit"
3918    )]
3919    pub exposure_time_unit: UnitsTime,
3920    #[serde(
3921        default,
3922        rename = "@PositionX",
3923        skip_serializing_if = "Option::is_none"
3924    )]
3925    pub position_x: Option<f32>,
3926    #[serde(default = "Plane::default_position_x_unit", rename = "@PositionXUnit")]
3927    pub position_x_unit: UnitsLength,
3928    #[serde(
3929        default,
3930        rename = "@PositionY",
3931        skip_serializing_if = "Option::is_none"
3932    )]
3933    pub position_y: Option<f32>,
3934    #[serde(default = "Plane::default_position_y_unit", rename = "@PositionYUnit")]
3935    pub position_y_unit: UnitsLength,
3936    #[serde(
3937        default,
3938        rename = "@PositionZ",
3939        skip_serializing_if = "Option::is_none"
3940    )]
3941    pub position_z: Option<f32>,
3942    #[serde(default = "Plane::default_position_z_unit", rename = "@PositionZUnit")]
3943    pub position_z_unit: UnitsLength,
3944    #[serde(rename = "HashSHA1", skip_serializing_if = "Option::is_none")]
3945    pub hash_sha1: Option<String>,
3946    #[serde(rename = "AnnotationRef", skip_serializing_if = "Option::is_none")]
3947    pub annotation_ref: Option<AnnotationRef>,
3948}
3949impl Plane {
3950    pub fn default_delta_t_unit() -> UnitsTime {
3951        UnitsTime::s
3952    }
3953    pub fn default_exposure_time_unit() -> UnitsTime {
3954        UnitsTime::s
3955    }
3956    pub fn default_position_x_unit() -> UnitsLength {
3957        UnitsLength::um
3958    }
3959    pub fn default_position_y_unit() -> UnitsLength {
3960        UnitsLength::um
3961    }
3962    pub fn default_position_z_unit() -> UnitsLength {
3963        UnitsLength::um
3964    }
3965}
3966impl Default for Plane {
3967    fn default() -> Self {
3968        Self {
3969            the_z: None,
3970            the_t: None,
3971            the_c: None,
3972            delta_t: None,
3973            delta_t_unit: Self::default_delta_t_unit(),
3974            exposure_time: None,
3975            exposure_time_unit: Self::default_exposure_time_unit(),
3976            position_x: None,
3977            position_x_unit: Self::default_position_x_unit(),
3978            position_y: None,
3979            position_y_unit: Self::default_position_y_unit(),
3980            position_z: None,
3981            position_z_unit: Self::default_position_z_unit(),
3982            hash_sha1: None,
3983            annotation_ref: None,
3984        }
3985    }
3986}
3987
3988#[cfg_attr(
3989    feature = "python",
3990    pyclass(
3991        module = "ome_metadata",
3992        skip_from_py_object,
3993        get_all,
3994        set_all,
3995        eq,
3996        new = "from_fields"
3997    ),
3998    derive(FromPyObject, PyOme)
3999)]
4000#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4001pub struct Plate {
4002    #[serde(rename = "@ID")]
4003    pub id: String,
4004    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4005    pub name: Option<String>,
4006    #[serde(default, rename = "@Status", skip_serializing_if = "Option::is_none")]
4007    pub status: Option<String>,
4008    #[serde(
4009        default,
4010        rename = "@ExternalIdentifier",
4011        skip_serializing_if = "Option::is_none"
4012    )]
4013    pub external_identifier: Option<String>,
4014    #[serde(
4015        default,
4016        rename = "@ColumnNamingConvention",
4017        skip_serializing_if = "Option::is_none"
4018    )]
4019    pub column_naming_convention: Option<NamingConventionType>,
4020    #[serde(
4021        default,
4022        rename = "@RowNamingConvention",
4023        skip_serializing_if = "Option::is_none"
4024    )]
4025    pub row_naming_convention: Option<NamingConventionType>,
4026    #[serde(
4027        default,
4028        rename = "@WellOriginX",
4029        skip_serializing_if = "Option::is_none"
4030    )]
4031    pub well_origin_x: Option<f32>,
4032    #[serde(
4033        default = "Plate::default_well_origin_x_unit",
4034        rename = "@WellOriginXUnit"
4035    )]
4036    pub well_origin_x_unit: UnitsLength,
4037    #[serde(
4038        default,
4039        rename = "@WellOriginY",
4040        skip_serializing_if = "Option::is_none"
4041    )]
4042    pub well_origin_y: Option<f32>,
4043    #[serde(
4044        default = "Plate::default_well_origin_y_unit",
4045        rename = "@WellOriginYUnit"
4046    )]
4047    pub well_origin_y_unit: UnitsLength,
4048    #[serde(default, rename = "@Rows", skip_serializing_if = "Option::is_none")]
4049    pub rows: Option<i32>,
4050    #[serde(default, rename = "@Columns", skip_serializing_if = "Option::is_none")]
4051    pub columns: Option<i32>,
4052    #[serde(
4053        default,
4054        rename = "@FieldIndex",
4055        skip_serializing_if = "Option::is_none"
4056    )]
4057    pub field_index: Option<i32>,
4058    #[serde(
4059        default,
4060        rename = "Description",
4061        skip_serializing_if = "Option::is_none"
4062    )]
4063    pub description: Option<String>,
4064    #[serde(default, rename = "Well", skip_serializing_if = "Vec::is_empty")]
4065    pub well: Vec<Well>,
4066    #[serde(
4067        default,
4068        rename = "AnnotationRef",
4069        skip_serializing_if = "Vec::is_empty"
4070    )]
4071    pub annotation_ref: Vec<AnnotationRef>,
4072    #[serde(
4073        default,
4074        rename = "PlateAcquisition",
4075        skip_serializing_if = "Vec::is_empty"
4076    )]
4077    pub plate_acquisition: Vec<PlateAcquisition>,
4078}
4079impl Plate {
4080    pub fn default_well_origin_x_unit() -> UnitsLength {
4081        UnitsLength::um
4082    }
4083    pub fn default_well_origin_y_unit() -> UnitsLength {
4084        UnitsLength::um
4085    }
4086}
4087impl Default for Plate {
4088    fn default() -> Self {
4089        Self {
4090            id: String::new(),
4091            name: None,
4092            status: None,
4093            external_identifier: None,
4094            column_naming_convention: None,
4095            row_naming_convention: None,
4096            well_origin_x: None,
4097            well_origin_x_unit: Self::default_well_origin_x_unit(),
4098            well_origin_y: None,
4099            well_origin_y_unit: Self::default_well_origin_y_unit(),
4100            rows: None,
4101            columns: None,
4102            field_index: None,
4103            description: None,
4104            well: Vec::new(),
4105            annotation_ref: Vec::new(),
4106            plate_acquisition: Vec::new(),
4107        }
4108    }
4109}
4110#[cfg_attr(
4111    feature = "python",
4112    pyclass(
4113        module = "ome_metadata",
4114        skip_from_py_object,
4115        get_all,
4116        set_all,
4117        eq,
4118        new = "from_fields"
4119    ),
4120    derive(FromPyObject, PyOme)
4121)]
4122#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4123pub struct PlateAcquisition {
4124    #[serde(rename = "@ID")]
4125    pub id: String,
4126    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4127    pub name: Option<String>,
4128    #[serde(default, rename = "@EndTime", skip_serializing_if = "Option::is_none")]
4129    pub end_time: Option<String>,
4130    #[serde(
4131        default,
4132        rename = "@StartTime",
4133        skip_serializing_if = "Option::is_none"
4134    )]
4135    pub start_time: Option<String>,
4136    #[serde(
4137        default,
4138        rename = "@MaximumFieldCount",
4139        skip_serializing_if = "Option::is_none"
4140    )]
4141    pub maximum_field_count: Option<i32>,
4142    #[serde(
4143        default,
4144        rename = "Description",
4145        skip_serializing_if = "Option::is_none"
4146    )]
4147    pub description: Option<String>,
4148    #[serde(
4149        default,
4150        rename = "WellSampleRef",
4151        skip_serializing_if = "Vec::is_empty"
4152    )]
4153    pub well_sample_ref: Vec<AnnotationRef>,
4154    #[serde(
4155        default,
4156        rename = "AnnotationRef",
4157        skip_serializing_if = "Vec::is_empty"
4158    )]
4159    pub annotation_ref: Vec<AnnotationRef>,
4160}
4161#[cfg_attr(
4162    feature = "python",
4163    pyclass(
4164        module = "ome_metadata",
4165        skip_from_py_object,
4166        get_all,
4167        set_all,
4168        eq,
4169        new = "from_fields"
4170    ),
4171    derive(FromPyObject, PyOme)
4172)]
4173#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4174pub struct Polygon {
4175    #[serde(
4176        default,
4177        rename = "@FillColor",
4178        skip_serializing_if = "Option::is_none"
4179    )]
4180    pub fill_color: Option<i32>,
4181    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
4182    pub fill_rule: Option<ShapeFillRuleType>,
4183    #[serde(
4184        default,
4185        rename = "@StrokeColor",
4186        skip_serializing_if = "Option::is_none"
4187    )]
4188    pub stroke_color: Option<i32>,
4189    #[serde(
4190        default,
4191        rename = "@StrokeWidth",
4192        skip_serializing_if = "Option::is_none"
4193    )]
4194    pub stroke_width: Option<f32>,
4195    #[serde(
4196        default = "Polygon::default_stroke_width_unit",
4197        rename = "@StrokeWidthUnit"
4198    )]
4199    pub stroke_width_unit: UnitsLength,
4200    #[serde(
4201        default,
4202        rename = "@StrokeDashArray",
4203        skip_serializing_if = "Option::is_none"
4204    )]
4205    pub stroke_dash_array: Option<String>,
4206    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
4207    pub text: Option<String>,
4208    #[serde(
4209        default,
4210        rename = "@FontFamily",
4211        skip_serializing_if = "Option::is_none"
4212    )]
4213    pub font_family: Option<FontFamilyType>,
4214    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
4215    pub font_size: Option<i32>,
4216    #[serde(default = "Polygon::default_font_size_unit", rename = "@FontSizeUnit")]
4217    pub font_size_unit: UnitsLength,
4218    #[serde(
4219        default,
4220        rename = "@FontStyle",
4221        skip_serializing_if = "Option::is_none"
4222    )]
4223    pub font_style: Option<ShapeFontStyleType>,
4224    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
4225    pub locked: Option<bool>,
4226    #[serde(rename = "@ID")]
4227    pub id: String,
4228    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
4229    pub the_z: Option<i32>,
4230    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
4231    pub the_t: Option<i32>,
4232    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
4233    pub the_c: Option<i32>,
4234    #[serde(rename = "@Points")]
4235    pub points: String,
4236    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
4237    pub transform: Option<AffineTransform>,
4238    #[serde(
4239        default,
4240        rename = "AnnotationRef",
4241        skip_serializing_if = "Vec::is_empty"
4242    )]
4243    pub annotation_ref: Vec<AnnotationRef>,
4244}
4245impl Polygon {
4246    pub fn default_stroke_width_unit() -> UnitsLength {
4247        UnitsLength::Pixel
4248    }
4249    pub fn default_font_size_unit() -> UnitsLength {
4250        UnitsLength::Pixel
4251    }
4252}
4253impl Default for Polygon {
4254    fn default() -> Self {
4255        Self {
4256            fill_color: None,
4257            fill_rule: None,
4258            stroke_color: None,
4259            stroke_width: None,
4260            stroke_width_unit: Self::default_stroke_width_unit(),
4261            stroke_dash_array: None,
4262            text: None,
4263            font_family: None,
4264            font_size: None,
4265            font_size_unit: Self::default_font_size_unit(),
4266            font_style: None,
4267            locked: None,
4268            id: String::new(),
4269            the_z: None,
4270            the_c: None,
4271            the_t: None,
4272            points: String::new(),
4273            transform: None,
4274            annotation_ref: Vec::new(),
4275        }
4276    }
4277}
4278#[cfg_attr(
4279    feature = "python",
4280    pyclass(
4281        module = "ome_metadata",
4282        skip_from_py_object,
4283        get_all,
4284        set_all,
4285        eq,
4286        new = "from_fields"
4287    ),
4288    derive(FromPyObject, PyOme)
4289)]
4290#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4291pub struct Polyline {
4292    #[serde(
4293        default,
4294        rename = "@FillColor",
4295        skip_serializing_if = "Option::is_none"
4296    )]
4297    pub fill_color: Option<i32>,
4298    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
4299    pub fill_rule: Option<ShapeFillRuleType>,
4300    #[serde(
4301        default,
4302        rename = "@StrokeColor",
4303        skip_serializing_if = "Option::is_none"
4304    )]
4305    pub stroke_color: Option<i32>,
4306    #[serde(
4307        default,
4308        rename = "@StrokeWidth",
4309        skip_serializing_if = "Option::is_none"
4310    )]
4311    pub stroke_width: Option<f32>,
4312    #[serde(
4313        default = "Polyline::default_stroke_width_unit",
4314        rename = "@StrokeWidthUnit"
4315    )]
4316    pub stroke_width_unit: UnitsLength,
4317    #[serde(
4318        default,
4319        rename = "@StrokeDashArray",
4320        skip_serializing_if = "Option::is_none"
4321    )]
4322    pub stroke_dash_array: Option<String>,
4323    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
4324    pub text: Option<String>,
4325    #[serde(
4326        default,
4327        rename = "@FontFamily",
4328        skip_serializing_if = "Option::is_none"
4329    )]
4330    pub font_family: Option<FontFamilyType>,
4331    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
4332    pub font_size: Option<i32>,
4333    #[serde(default = "Polyline::default_font_size_unit", rename = "@FontSizeUnit")]
4334    pub font_size_unit: UnitsLength,
4335    #[serde(
4336        default,
4337        rename = "@FontStyle",
4338        skip_serializing_if = "Option::is_none"
4339    )]
4340    pub font_style: Option<ShapeFontStyleType>,
4341    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
4342    pub locked: Option<bool>,
4343    #[serde(rename = "@ID")]
4344    pub id: String,
4345    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
4346    pub the_z: Option<i32>,
4347    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
4348    pub the_t: Option<i32>,
4349    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
4350    pub the_c: Option<i32>,
4351    #[serde(rename = "@Points")]
4352    pub points: String,
4353    #[serde(
4354        default,
4355        rename = "@MarkerStart",
4356        skip_serializing_if = "Option::is_none"
4357    )]
4358    pub marker_start: Option<MarkerType>,
4359    #[serde(
4360        default,
4361        rename = "@MarkerEnd",
4362        skip_serializing_if = "Option::is_none"
4363    )]
4364    pub marker_end: Option<MarkerType>,
4365    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
4366    pub transform: Option<AffineTransform>,
4367    #[serde(
4368        default,
4369        rename = "AnnotationRef",
4370        skip_serializing_if = "Vec::is_empty"
4371    )]
4372    pub annotation_ref: Vec<AnnotationRef>,
4373}
4374impl Polyline {
4375    pub fn default_stroke_width_unit() -> UnitsLength {
4376        UnitsLength::Pixel
4377    }
4378    pub fn default_font_size_unit() -> UnitsLength {
4379        UnitsLength::Pixel
4380    }
4381}
4382impl Default for Polyline {
4383    fn default() -> Self {
4384        Self {
4385            fill_color: None,
4386            fill_rule: None,
4387            stroke_color: None,
4388            stroke_width: None,
4389            stroke_width_unit: Self::default_stroke_width_unit(),
4390            stroke_dash_array: None,
4391            text: None,
4392            font_family: None,
4393            font_size: None,
4394            font_size_unit: Self::default_font_size_unit(),
4395            font_style: None,
4396            locked: None,
4397            id: String::new(),
4398            the_z: None,
4399            the_c: None,
4400            the_t: None,
4401            points: String::new(),
4402            marker_start: None,
4403            marker_end: None,
4404            transform: None,
4405            annotation_ref: Vec::new(),
4406        }
4407    }
4408}
4409#[cfg_attr(
4410    feature = "python",
4411    pyclass(
4412        module = "ome_metadata",
4413        skip_from_py_object,
4414        get_all,
4415        set_all,
4416        eq,
4417        new = "from_fields"
4418    ),
4419    derive(FromPyObject, PyOme)
4420)]
4421#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4422pub struct Project {
4423    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4424    pub name: Option<String>,
4425    #[serde(rename = "@ID")]
4426    pub id: String,
4427    #[serde(
4428        default,
4429        rename = "Description",
4430        skip_serializing_if = "Option::is_none"
4431    )]
4432    pub description: Option<String>,
4433    #[serde(
4434        default,
4435        rename = "ExperimenterRef",
4436        skip_serializing_if = "Option::is_none"
4437    )]
4438    pub experimenter_ref: Option<AnnotationRef>,
4439    #[serde(
4440        default,
4441        rename = "ExperimenterGroupRef",
4442        skip_serializing_if = "Option::is_none"
4443    )]
4444    pub experimenter_group_ref: Option<AnnotationRef>,
4445    #[serde(default, rename = "DatasetRef", skip_serializing_if = "Vec::is_empty")]
4446    pub dataset_ref: Vec<AnnotationRef>,
4447    #[serde(
4448        default,
4449        rename = "AnnotationRef",
4450        skip_serializing_if = "Vec::is_empty"
4451    )]
4452    pub annotation_ref: Vec<AnnotationRef>,
4453}
4454#[cfg_attr(
4455    feature = "python",
4456    pyclass(
4457        module = "ome_metadata",
4458        skip_from_py_object,
4459        get_all,
4460        set_all,
4461        eq,
4462        new = "from_fields"
4463    ),
4464    derive(FromPyObject, PyOme)
4465)]
4466#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4467pub struct Roi {
4468    #[serde(rename = "@ID")]
4469    pub id: String,
4470    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4471    pub name: Option<String>,
4472    #[serde(rename = "Union", skip_serializing_if = "Option::is_none")]
4473    pub union: Option<RoiUnion>,
4474    #[serde(rename = "AnnotationRef", skip_serializing_if = "Option::is_none")]
4475    pub annotation_ref: Option<AnnotationRef>,
4476    #[serde(rename = "Description", skip_serializing_if = "Option::is_none")]
4477    pub description: Option<String>,
4478}
4479#[cfg_attr(
4480    feature = "python",
4481    pyclass(
4482        module = "ome_metadata",
4483        skip_from_py_object,
4484        get_all,
4485        set_all,
4486        eq,
4487        new = "from_fields"
4488    ),
4489    derive(FromPyObject, PyOme)
4490)]
4491#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4492pub struct Reagent {
4493    #[serde(rename = "@ID")]
4494    pub id: String,
4495    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4496    pub name: Option<String>,
4497    #[serde(
4498        default,
4499        rename = "@ReagentIdentifier",
4500        skip_serializing_if = "Option::is_none"
4501    )]
4502    pub reagent_identifier: Option<String>,
4503    #[serde(
4504        default,
4505        rename = "Description",
4506        skip_serializing_if = "Option::is_none"
4507    )]
4508    pub description: Option<String>,
4509    #[serde(
4510        default,
4511        rename = "AnnotationRef",
4512        skip_serializing_if = "Vec::is_empty"
4513    )]
4514    pub annotation_ref: Vec<AnnotationRef>,
4515}
4516#[cfg_attr(
4517    feature = "python",
4518    pyclass(
4519        module = "ome_metadata",
4520        skip_from_py_object,
4521        get_all,
4522        set_all,
4523        eq,
4524        new = "from_fields"
4525    ),
4526    derive(FromPyObject, PyOme)
4527)]
4528#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4529pub struct Rectangle {
4530    #[serde(
4531        default,
4532        rename = "@FillColor",
4533        skip_serializing_if = "Option::is_none"
4534    )]
4535    pub fill_color: Option<i32>,
4536    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
4537    pub fill_rule: Option<ShapeFillRuleType>,
4538    #[serde(
4539        default,
4540        rename = "@StrokeColor",
4541        skip_serializing_if = "Option::is_none"
4542    )]
4543    pub stroke_color: Option<i32>,
4544    #[serde(
4545        default,
4546        rename = "@StrokeWidth",
4547        skip_serializing_if = "Option::is_none"
4548    )]
4549    pub stroke_width: Option<f32>,
4550    #[serde(
4551        default = "Rectangle::default_stroke_width_unit",
4552        rename = "@StrokeWidthUnit"
4553    )]
4554    pub stroke_width_unit: UnitsLength,
4555    #[serde(
4556        default,
4557        rename = "@StrokeDashArray",
4558        skip_serializing_if = "Option::is_none"
4559    )]
4560    pub stroke_dash_array: Option<String>,
4561    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
4562    pub text: Option<String>,
4563    #[serde(
4564        default,
4565        rename = "@FontFamily",
4566        skip_serializing_if = "Option::is_none"
4567    )]
4568    pub font_family: Option<FontFamilyType>,
4569    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
4570    pub font_size: Option<i32>,
4571    #[serde(
4572        default = "Rectangle::default_font_size_unit",
4573        rename = "@FontSizeUnit"
4574    )]
4575    pub font_size_unit: UnitsLength,
4576    #[serde(
4577        default,
4578        rename = "@FontStyle",
4579        skip_serializing_if = "Option::is_none"
4580    )]
4581    pub font_style: Option<ShapeFontStyleType>,
4582    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
4583    pub locked: Option<bool>,
4584    #[serde(rename = "@ID")]
4585    pub id: String,
4586    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
4587    pub the_z: Option<i32>,
4588    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
4589    pub the_t: Option<i32>,
4590    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
4591    pub the_c: Option<i32>,
4592    #[serde(rename = "@X")]
4593    pub x: f32,
4594    #[serde(rename = "@Y")]
4595    pub y: f32,
4596    #[serde(rename = "@Width")]
4597    pub width: f32,
4598    #[serde(rename = "@Height")]
4599    pub height: f32,
4600    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
4601    pub transform: Option<AffineTransform>,
4602    #[serde(
4603        default,
4604        rename = "AnnotationRef",
4605        skip_serializing_if = "Vec::is_empty"
4606    )]
4607    pub annotation_ref: Vec<AnnotationRef>,
4608}
4609impl Rectangle {
4610    pub fn default_stroke_width_unit() -> UnitsLength {
4611        UnitsLength::Pixel
4612    }
4613    pub fn default_font_size_unit() -> UnitsLength {
4614        UnitsLength::Pixel
4615    }
4616}
4617impl Default for Rectangle {
4618    fn default() -> Self {
4619        Self {
4620            fill_color: None,
4621            fill_rule: None,
4622            stroke_color: None,
4623            stroke_width: None,
4624            stroke_width_unit: Self::default_stroke_width_unit(),
4625            stroke_dash_array: None,
4626            text: None,
4627            font_family: None,
4628            font_size: None,
4629            font_size_unit: Self::default_font_size_unit(),
4630            font_style: None,
4631            locked: None,
4632            id: String::new(),
4633            the_z: None,
4634            the_c: None,
4635            x: 0.0,
4636            y: 0.0,
4637            width: 0.0,
4638            the_t: None,
4639            transform: None,
4640            annotation_ref: Vec::new(),
4641            height: 0.0,
4642        }
4643    }
4644}
4645#[cfg_attr(
4646    feature = "python",
4647    pyclass(
4648        module = "ome_metadata",
4649        skip_from_py_object,
4650        get_all,
4651        set_all,
4652        eq,
4653        new = "from_fields"
4654    ),
4655    derive(FromPyObject, PyOme)
4656)]
4657#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4658pub struct Rights {
4659    #[serde(
4660        default,
4661        rename = "RightsHolder",
4662        skip_serializing_if = "Option::is_none"
4663    )]
4664    pub rights_holder: Option<String>,
4665    #[serde(
4666        default,
4667        rename = "RightsHeld",
4668        skip_serializing_if = "Option::is_none"
4669    )]
4670    pub rights_held: Option<String>,
4671}
4672#[cfg_attr(
4673    feature = "python",
4674    pyclass(
4675        module = "ome_metadata",
4676        skip_from_py_object,
4677        get_all,
4678        set_all,
4679        eq,
4680        new = "from_fields"
4681    ),
4682    derive(FromPyObject, PyOme)
4683)]
4684#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4685pub struct RoiUnion {
4686    #[serde(default, rename = "ShapeGroup", skip_serializing_if = "Vec::is_empty")]
4687    pub shape_group: Vec<ShapeGroup>,
4688}
4689#[cfg_attr(
4690    feature = "python",
4691    pyclass(
4692        module = "ome_metadata",
4693        skip_from_py_object,
4694        get_all,
4695        set_all,
4696        eq,
4697        new = "from_fields"
4698    ),
4699    derive(FromPyObject, PyOme)
4700)]
4701#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
4702pub struct Screen {
4703    #[serde(rename = "@ID")]
4704    pub id: String,
4705    #[serde(default, rename = "@Name", skip_serializing_if = "Option::is_none")]
4706    pub name: Option<String>,
4707    #[serde(
4708        default,
4709        rename = "@ProtocolIdentifier",
4710        skip_serializing_if = "Option::is_none"
4711    )]
4712    pub protocol_identifier: Option<String>,
4713    #[serde(
4714        default,
4715        rename = "@ProtocolDescription",
4716        skip_serializing_if = "Option::is_none"
4717    )]
4718    pub protocol_description: Option<String>,
4719    #[serde(
4720        default,
4721        rename = "@ReagentSetDescription",
4722        skip_serializing_if = "Option::is_none"
4723    )]
4724    pub reagent_set_description: Option<String>,
4725    #[serde(
4726        default,
4727        rename = "@ReagentSetIdentifier",
4728        skip_serializing_if = "Option::is_none"
4729    )]
4730    pub reagent_set_identifier: Option<String>,
4731    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
4732    pub r#type: Option<String>,
4733    #[serde(
4734        default,
4735        rename = "Description",
4736        skip_serializing_if = "Option::is_none"
4737    )]
4738    pub description: Option<String>,
4739    #[serde(default, rename = "Reagent", skip_serializing_if = "Vec::is_empty")]
4740    pub reagent: Vec<Reagent>,
4741    #[serde(default, rename = "PlateRef", skip_serializing_if = "Vec::is_empty")]
4742    pub plate_ref: Vec<AnnotationRef>,
4743    #[serde(
4744        default,
4745        rename = "AnnotationRef",
4746        skip_serializing_if = "Vec::is_empty"
4747    )]
4748    pub annotation_ref: Vec<AnnotationRef>,
4749}
4750#[cfg_attr(
4751    feature = "python",
4752    pyclass(
4753        module = "ome_metadata",
4754        skip_from_py_object,
4755        get_all,
4756        set_all,
4757        eq,
4758        new = "from_fields"
4759    ),
4760    derive(FromPyObject, PyOme)
4761)]
4762#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4763pub struct ShapeType {
4764    #[serde(
4765        default,
4766        rename = "@FillColor",
4767        skip_serializing_if = "Option::is_none"
4768    )]
4769    pub fill_color: Option<i32>,
4770    #[serde(default, rename = "@FillRule", skip_serializing_if = "Option::is_none")]
4771    pub fill_rule: Option<ShapeFillRuleType>,
4772    #[serde(
4773        default,
4774        rename = "@StrokeColor",
4775        skip_serializing_if = "Option::is_none"
4776    )]
4777    pub stroke_color: Option<i32>,
4778    #[serde(
4779        default,
4780        rename = "@StrokeWidth",
4781        skip_serializing_if = "Option::is_none"
4782    )]
4783    pub stroke_width: Option<f32>,
4784    #[serde(
4785        default = "ShapeType::default_stroke_width_unit",
4786        rename = "@StrokeWidthUnit"
4787    )]
4788    pub stroke_width_unit: UnitsLength,
4789    #[serde(
4790        default,
4791        rename = "@StrokeDashArray",
4792        skip_serializing_if = "Option::is_none"
4793    )]
4794    pub stroke_dash_array: Option<String>,
4795    #[serde(default, rename = "@Text", skip_serializing_if = "Option::is_none")]
4796    pub text: Option<String>,
4797    #[serde(
4798        default,
4799        rename = "@FontFamily",
4800        skip_serializing_if = "Option::is_none"
4801    )]
4802    pub font_family: Option<FontFamilyType>,
4803    #[serde(default, rename = "@FontSize", skip_serializing_if = "Option::is_none")]
4804    pub font_size: Option<i32>,
4805    #[serde(
4806        default = "ShapeType::default_font_size_unit",
4807        rename = "@FontSizeUnit"
4808    )]
4809    pub font_size_unit: UnitsLength,
4810    #[serde(
4811        default,
4812        rename = "@FontStyle",
4813        skip_serializing_if = "Option::is_none"
4814    )]
4815    pub font_style: Option<ShapeFontStyleType>,
4816    #[serde(default, rename = "@Locked", skip_serializing_if = "Option::is_none")]
4817    pub locked: Option<bool>,
4818    #[serde(rename = "@ID")]
4819    pub id: String,
4820    #[serde(default, rename = "@TheZ", skip_serializing_if = "Option::is_none")]
4821    pub the_z: Option<i32>,
4822    #[serde(default, rename = "@TheT", skip_serializing_if = "Option::is_none")]
4823    pub the_t: Option<i32>,
4824    #[serde(default, rename = "@TheC", skip_serializing_if = "Option::is_none")]
4825    pub the_c: Option<i32>,
4826    #[serde(default, rename = "Transform", skip_serializing_if = "Option::is_none")]
4827    pub transform: Option<AffineTransform>,
4828    #[serde(
4829        default,
4830        rename = "AnnotationRef",
4831        skip_serializing_if = "Vec::is_empty"
4832    )]
4833    pub annotation_ref: Vec<AnnotationRef>,
4834}
4835impl ShapeType {
4836    pub fn default_stroke_width_unit() -> UnitsLength {
4837        UnitsLength::Pixel
4838    }
4839    pub fn default_font_size_unit() -> UnitsLength {
4840        UnitsLength::Pixel
4841    }
4842}
4843impl Default for ShapeType {
4844    fn default() -> Self {
4845        Self {
4846            fill_color: None,
4847            fill_rule: None,
4848            stroke_color: None,
4849            stroke_width: None,
4850            stroke_width_unit: Self::default_stroke_width_unit(),
4851            stroke_dash_array: None,
4852            text: None,
4853            font_family: None,
4854            font_size: None,
4855            font_size_unit: Self::default_font_size_unit(),
4856            font_style: None,
4857            locked: None,
4858            id: String::new(),
4859            the_z: None,
4860            the_t: None,
4861            the_c: None,
4862            transform: None,
4863            annotation_ref: Vec::new(),
4864        }
4865    }
4866}
4867#[derive(
4868    EnumString,
4869    AsRefStr,
4870    Debug,
4871    strum::Display,
4872    Clone,
4873    Copy,
4874    PartialEq,
4875    Eq,
4876    PartialOrd,
4877    Ord,
4878    Hash,
4879    Deserialize,
4880    Serialize,
4881    VariantNames,
4882    OmeXML,
4883)]
4884#[strum(ascii_case_insensitive)]
4885#[cfg_attr(
4886    feature = "python",
4887    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
4888    derive(PyOmeEnum)
4889)]
4890pub enum ShapeFillRuleType {
4891    #[serde(rename = "EvenOdd")]
4892    EvenOdd,
4893    #[serde(rename = "NonZero")]
4894    NonZero,
4895}
4896#[derive(
4897    EnumString,
4898    AsRefStr,
4899    Debug,
4900    strum::Display,
4901    Clone,
4902    Copy,
4903    PartialEq,
4904    Eq,
4905    PartialOrd,
4906    Ord,
4907    Hash,
4908    Deserialize,
4909    Serialize,
4910    VariantNames,
4911    OmeXML,
4912)]
4913#[strum(ascii_case_insensitive)]
4914#[cfg_attr(
4915    feature = "python",
4916    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
4917    derive(PyOmeEnum)
4918)]
4919pub enum ShapeFontStyleType {
4920    #[serde(rename = "Bold")]
4921    Bold,
4922    #[serde(rename = "BoldItalic")]
4923    BoldItalic,
4924    #[serde(rename = "Italic")]
4925    Italic,
4926    #[serde(rename = "Normal")]
4927    Normal,
4928}
4929#[derive(
4930    AsRefStr, Debug, strum::Display, Clone, PartialEq, Deserialize, Serialize, VariantNames, OmeXML,
4931)]
4932#[strum(ascii_case_insensitive)]
4933#[cfg_attr(
4934    feature = "python",
4935    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
4936    derive(PyOmeComplexEnum)
4937)]
4938pub enum ShapeGroup {
4939    #[serde(rename = "Rectangle")]
4940    Rectangle(Rectangle),
4941    #[serde(rename = "Mask")]
4942    Mask(Mask),
4943    #[serde(rename = "Point")]
4944    Point(Label),
4945    #[serde(rename = "Ellipse")]
4946    Ellipse(Ellipse),
4947    #[serde(rename = "Line")]
4948    Line(Line),
4949    #[serde(rename = "Polyline")]
4950    Polyline(Polyline),
4951    #[serde(rename = "Polygon")]
4952    Polygon(Polygon),
4953    #[serde(rename = "Label")]
4954    Label(Label),
4955}
4956#[cfg_attr(
4957    feature = "python",
4958    pyclass(
4959        module = "ome_metadata",
4960        skip_from_py_object,
4961        get_all,
4962        set_all,
4963        eq,
4964        new = "from_fields"
4965    ),
4966    derive(FromPyObject, PyOme)
4967)]
4968#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
4969pub struct StageLabel {
4970    #[serde(rename = "@Name")]
4971    pub name: String,
4972    #[serde(default, rename = "@X", skip_serializing_if = "Option::is_none")]
4973    pub x: Option<f32>,
4974    #[serde(default = "StageLabel::default_x_unit", rename = "@XUnit")]
4975    pub x_unit: UnitsLength,
4976    #[serde(default, rename = "@Y", skip_serializing_if = "Option::is_none")]
4977    pub y: Option<f32>,
4978    #[serde(default = "StageLabel::default_y_unit", rename = "@YUnit")]
4979    pub y_unit: UnitsLength,
4980    #[serde(default, rename = "@Z", skip_serializing_if = "Option::is_none")]
4981    pub z: Option<f32>,
4982    #[serde(default = "StageLabel::default_z_unit", rename = "@ZUnit")]
4983    pub z_unit: UnitsLength,
4984}
4985impl StageLabel {
4986    pub fn default_x_unit() -> UnitsLength {
4987        UnitsLength::um
4988    }
4989    pub fn default_y_unit() -> UnitsLength {
4990        UnitsLength::um
4991    }
4992    pub fn default_z_unit() -> UnitsLength {
4993        UnitsLength::um
4994    }
4995}
4996impl Default for StageLabel {
4997    fn default() -> Self {
4998        Self {
4999            name: String::new(),
5000            x: None,
5001            x_unit: Self::default_x_unit(),
5002            y: None,
5003            y_unit: Self::default_y_unit(),
5004            z: None,
5005            z_unit: Self::default_z_unit(),
5006        }
5007    }
5008}
5009#[cfg_attr(
5010    feature = "python",
5011    pyclass(
5012        module = "ome_metadata",
5013        skip_from_py_object,
5014        get_all,
5015        set_all,
5016        eq,
5017        new = "from_fields"
5018    ),
5019    derive(FromPyObject, PyOme)
5020)]
5021#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5022pub struct StructuredAnnotations {
5023    #[serde(default, rename = "$value", skip_serializing_if = "Option::is_none")]
5024    pub content: Option<StructuredAnnotationsContent>,
5025}
5026#[allow(clippy::enum_variant_names)]
5027#[derive(
5028    AsRefStr, Debug, strum::Display, Clone, PartialEq, Deserialize, Serialize, VariantNames, OmeXML,
5029)]
5030#[strum(ascii_case_insensitive)]
5031#[cfg_attr(
5032    feature = "python",
5033    pyclass(module = "ome_metadata", from_py_object, get_all, set_all, eq),
5034    derive(PyOmeComplexEnum)
5035)]
5036pub enum StructuredAnnotationsContent {
5037    #[serde(rename = "XMLAnnotation")]
5038    XmlAnnotation(XmlAnnotation),
5039    #[serde(rename = "FileAnnotation")]
5040    FileAnnotation(FileAnnotation),
5041    #[serde(rename = "ListAnnotation")]
5042    ListAnnotation(Annotation),
5043    #[serde(rename = "LongAnnotation")]
5044    LongAnnotation(LongAnnotation),
5045    #[serde(rename = "DoubleAnnotation")]
5046    DoubleAnnotation(DoubleAnnotation),
5047    #[serde(rename = "CommentAnnotation")]
5048    CommentAnnotation(CommentAnnotation),
5049    #[serde(rename = "BooleanAnnotation")]
5050    BooleanAnnotation(BooleanAnnotation),
5051    #[serde(rename = "TimestampAnnotation")]
5052    TimestampAnnotation(CommentAnnotation),
5053    #[serde(rename = "TagAnnotation")]
5054    TagAnnotation(CommentAnnotation),
5055    #[serde(rename = "TermAnnotation")]
5056    TermAnnotation(CommentAnnotation),
5057    #[serde(rename = "MapAnnotation")]
5058    MapAnnotation(MapAnnotation),
5059}
5060#[cfg_attr(
5061    feature = "python",
5062    pyclass(
5063        module = "ome_metadata",
5064        skip_from_py_object,
5065        get_all,
5066        set_all,
5067        eq,
5068        new = "from_fields"
5069    ),
5070    derive(FromPyObject, PyOme)
5071)]
5072#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5073pub struct TiffData {
5074    #[serde(default = "TiffData::default_ifd", rename = "@IFD")]
5075    pub ifd: i32,
5076    #[serde(default = "TiffData::default_first_z", rename = "@FirstZ")]
5077    pub first_z: i32,
5078    #[serde(default = "TiffData::default_first_t", rename = "@FirstT")]
5079    pub first_t: i32,
5080    #[serde(default = "TiffData::default_first_c", rename = "@FirstC")]
5081    pub first_c: i32,
5082    #[serde(
5083        default,
5084        rename = "@PlaneCount",
5085        skip_serializing_if = "Option::is_none"
5086    )]
5087    pub plane_count: Option<i32>,
5088    #[serde(default, rename = "UUID", skip_serializing_if = "Option::is_none")]
5089    pub uuid: Option<TiffDataUuid>,
5090}
5091impl TiffData {
5092    pub fn default_ifd() -> i32 {
5093        0
5094    }
5095    pub fn default_first_z() -> i32 {
5096        0
5097    }
5098    pub fn default_first_t() -> i32 {
5099        0
5100    }
5101    pub fn default_first_c() -> i32 {
5102        0
5103    }
5104}
5105#[cfg_attr(
5106    feature = "python",
5107    pyclass(
5108        module = "ome_metadata",
5109        skip_from_py_object,
5110        get_all,
5111        set_all,
5112        eq,
5113        new = "from_fields"
5114    ),
5115    derive(FromPyObject, PyOme)
5116)]
5117#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5118pub struct TiffDataUuid {
5119    #[serde(default, rename = "@FileName", skip_serializing_if = "Option::is_none")]
5120    pub file_name: Option<String>,
5121    #[serde(rename = "$text")]
5122    pub content: String,
5123}
5124#[cfg_attr(
5125    feature = "python",
5126    pyclass(
5127        module = "ome_metadata",
5128        skip_from_py_object,
5129        get_all,
5130        set_all,
5131        eq,
5132        new = "from_fields"
5133    ),
5134    derive(FromPyObject, PyOme)
5135)]
5136#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
5137pub struct TransmittanceRange {
5138    #[serde(default, rename = "@CutIn", skip_serializing_if = "Option::is_none")]
5139    pub cut_in: Option<f32>,
5140    #[serde(
5141        default = "TransmittanceRange::default_cut_in_unit",
5142        rename = "@CutInUnit"
5143    )]
5144    pub cut_in_unit: UnitsLength,
5145    #[serde(default, rename = "@CutOut", skip_serializing_if = "Option::is_none")]
5146    pub cut_out: Option<f32>,
5147    #[serde(
5148        default = "TransmittanceRange::default_cut_out_unit",
5149        rename = "@CutOutUnit"
5150    )]
5151    pub cut_out_unit: UnitsLength,
5152    #[serde(
5153        default,
5154        rename = "@CutInTolerance",
5155        skip_serializing_if = "Option::is_none"
5156    )]
5157    pub cut_in_tolerance: Option<f32>,
5158    #[serde(
5159        default = "TransmittanceRange::default_cut_in_tolerance_unit",
5160        rename = "@CutInToleranceUnit"
5161    )]
5162    pub cut_in_tolerance_unit: UnitsLength,
5163    #[serde(
5164        default,
5165        rename = "@CutOutTolerance",
5166        skip_serializing_if = "Option::is_none"
5167    )]
5168    pub cut_out_tolerance: Option<f32>,
5169    #[serde(
5170        default = "TransmittanceRange::default_cut_out_tolerance_unit",
5171        rename = "@CutOutToleranceUnit"
5172    )]
5173    pub cut_out_tolerance_unit: UnitsLength,
5174    #[serde(
5175        default,
5176        rename = "@Transmittance",
5177        skip_serializing_if = "Option::is_none"
5178    )]
5179    pub transmittance: Option<f32>,
5180}
5181impl TransmittanceRange {
5182    pub fn default_cut_in_unit() -> UnitsLength {
5183        UnitsLength::m
5184    }
5185    pub fn default_cut_out_unit() -> UnitsLength {
5186        UnitsLength::m
5187    }
5188    pub fn default_cut_in_tolerance_unit() -> UnitsLength {
5189        UnitsLength::m
5190    }
5191    pub fn default_cut_out_tolerance_unit() -> UnitsLength {
5192        UnitsLength::m
5193    }
5194}
5195impl Default for TransmittanceRange {
5196    fn default() -> Self {
5197        Self {
5198            cut_in: None,
5199            cut_in_unit: Self::default_cut_in_unit(),
5200            cut_out: None,
5201            cut_out_unit: Self::default_cut_out_unit(),
5202            cut_in_tolerance: None,
5203            cut_in_tolerance_unit: Self::default_cut_in_tolerance_unit(),
5204            cut_out_tolerance: None,
5205            cut_out_tolerance_unit: Self::default_cut_out_tolerance_unit(),
5206            transmittance: None,
5207        }
5208    }
5209}
5210
5211#[derive(
5212    EnumString,
5213    AsRefStr,
5214    Debug,
5215    strum::Display,
5216    Clone,
5217    Copy,
5218    PartialEq,
5219    Eq,
5220    PartialOrd,
5221    Ord,
5222    Hash,
5223    Deserialize,
5224    Serialize,
5225    VariantNames,
5226    OmeXML,
5227)]
5228#[strum(ascii_case_insensitive)]
5229#[cfg_attr(
5230    feature = "python",
5231    pyclass(
5232        module = "ome_metadata",
5233        from_py_object,
5234        get_all,
5235        set_all,
5236        eq,
5237        frozen,
5238        hash
5239    ),
5240    derive(PyOmeUnit)
5241)]
5242pub enum UnitsElectricPotential {
5243    YV,
5244    ZV,
5245    EV,
5246    PV,
5247    TV,
5248    GV,
5249    MV,
5250    kV,
5251    hV,
5252    daV,
5253    V,
5254    dV,
5255    cV,
5256    mV,
5257    #[serde(rename = "µV")]
5258    uV,
5259    nV,
5260    pV,
5261    fV,
5262    aV,
5263    zV,
5264    yV,
5265}
5266#[derive(
5267    EnumString,
5268    AsRefStr,
5269    Debug,
5270    strum::Display,
5271    Clone,
5272    Copy,
5273    PartialEq,
5274    Eq,
5275    PartialOrd,
5276    Ord,
5277    Hash,
5278    Deserialize,
5279    Serialize,
5280    VariantNames,
5281    OmeXML,
5282)]
5283#[strum(ascii_case_insensitive)]
5284#[cfg_attr(
5285    feature = "python",
5286    pyclass(
5287        module = "ome_metadata",
5288        from_py_object,
5289        get_all,
5290        set_all,
5291        eq,
5292        frozen,
5293        hash
5294    ),
5295    derive(PyOmeUnit)
5296)]
5297pub enum UnitsFrequency {
5298    YHz,
5299    ZHz,
5300    EHz,
5301    PHz,
5302    THz,
5303    GHz,
5304    MHz,
5305    kHz,
5306    hHz,
5307    daHz,
5308    Hz,
5309    dHz,
5310    cHz,
5311    mHz,
5312    #[serde(rename = "µHz")]
5313    uHz,
5314    nHz,
5315    pHz,
5316    fHz,
5317    aHz,
5318    zHz,
5319    yHz,
5320}
5321#[derive(
5322    EnumString,
5323    AsRefStr,
5324    Debug,
5325    strum::Display,
5326    Clone,
5327    Copy,
5328    PartialEq,
5329    Eq,
5330    PartialOrd,
5331    Ord,
5332    Hash,
5333    Deserialize,
5334    Serialize,
5335    VariantNames,
5336    OmeXML,
5337)]
5338#[strum(ascii_case_insensitive)]
5339#[cfg_attr(
5340    feature = "python",
5341    pyclass(
5342        module = "ome_metadata",
5343        from_py_object,
5344        get_all,
5345        set_all,
5346        eq,
5347        frozen,
5348        hash
5349    ),
5350    derive(PyOmeUnit)
5351)]
5352pub enum UnitsLength {
5353    Ym,
5354    Zm,
5355    Em,
5356    Pm,
5357    Tm,
5358    Gm,
5359    Mm,
5360    km,
5361    hm,
5362    dam,
5363    m,
5364    dm,
5365    cm,
5366    mm,
5367    #[serde(rename = "µm")]
5368    um,
5369    nm,
5370    pm,
5371    fm,
5372    am,
5373    zm,
5374    ym,
5375    #[serde(rename = "Å")]
5376    A,
5377    #[serde(rename = "thou")]
5378    Thou,
5379    #[serde(rename = "li")]
5380    Li,
5381    #[serde(rename = "in")]
5382    In,
5383    #[serde(rename = "ft")]
5384    Ft,
5385    #[serde(rename = "yd")]
5386    Yd,
5387    #[serde(rename = "mi")]
5388    Mi,
5389    #[serde(rename = "ua")]
5390    Ua,
5391    #[serde(rename = "ly")]
5392    Ly,
5393    #[serde(rename = "pc")]
5394    Pc,
5395    #[serde(rename = "pt")]
5396    Pt,
5397    #[serde(rename = "pixel")]
5398    Pixel,
5399    #[serde(rename = "reference frame")]
5400    ReferenceFrame,
5401}
5402#[derive(
5403    EnumString,
5404    AsRefStr,
5405    Debug,
5406    strum::Display,
5407    Clone,
5408    Copy,
5409    PartialEq,
5410    Eq,
5411    PartialOrd,
5412    Ord,
5413    Hash,
5414    Deserialize,
5415    Serialize,
5416    VariantNames,
5417    OmeXML,
5418)]
5419#[strum(ascii_case_insensitive)]
5420#[cfg_attr(
5421    feature = "python",
5422    pyclass(
5423        module = "ome_metadata",
5424        from_py_object,
5425        get_all,
5426        set_all,
5427        eq,
5428        frozen,
5429        hash
5430    ),
5431    derive(PyOmeUnit)
5432)]
5433pub enum UnitsPower {
5434    YW,
5435    ZW,
5436    EW,
5437    PW,
5438    TW,
5439    GW,
5440    MW,
5441    kW,
5442    hW,
5443    daW,
5444    W,
5445    dW,
5446    cW,
5447    mW,
5448    #[serde(rename = "µW")]
5449    uW,
5450    nW,
5451    pW,
5452    fW,
5453    aW,
5454    zW,
5455    yW,
5456}
5457#[derive(
5458    EnumString,
5459    AsRefStr,
5460    Debug,
5461    strum::Display,
5462    Clone,
5463    Copy,
5464    PartialEq,
5465    Eq,
5466    PartialOrd,
5467    Ord,
5468    Hash,
5469    Deserialize,
5470    Serialize,
5471    VariantNames,
5472    OmeXML,
5473)]
5474#[strum(ascii_case_insensitive)]
5475#[cfg_attr(
5476    feature = "python",
5477    pyclass(
5478        module = "ome_metadata",
5479        from_py_object,
5480        get_all,
5481        set_all,
5482        eq,
5483        frozen,
5484        hash
5485    ),
5486    derive(PyOmeUnit)
5487)]
5488pub enum UnitsPressure {
5489    YPa,
5490    ZPa,
5491    EPa,
5492    PPa,
5493    TPa,
5494    GPa,
5495    MPa,
5496    kPa,
5497    hPa,
5498    daPa,
5499    Pa,
5500    dPa,
5501    cPa,
5502    mPa,
5503    #[serde(rename = "µPa")]
5504    uPa,
5505    nPa,
5506    pPa,
5507    fPa,
5508    aPa,
5509    zPa,
5510    yPa,
5511    bar,
5512    Mbar,
5513    kbar,
5514    dbar,
5515    cbar,
5516    mbar,
5517    atm,
5518    psi,
5519    Torr,
5520    mTorr,
5521    #[serde(rename = "mm Hg")]
5522    mmHg,
5523}
5524#[derive(
5525    EnumString,
5526    AsRefStr,
5527    Debug,
5528    strum::Display,
5529    Clone,
5530    Copy,
5531    PartialEq,
5532    Eq,
5533    PartialOrd,
5534    Ord,
5535    Hash,
5536    Deserialize,
5537    Serialize,
5538    VariantNames,
5539    OmeXML,
5540)]
5541#[strum(ascii_case_insensitive)]
5542#[cfg_attr(
5543    feature = "python",
5544    pyclass(
5545        module = "ome_metadata",
5546        from_py_object,
5547        get_all,
5548        set_all,
5549        eq,
5550        frozen,
5551        hash
5552    ),
5553    derive(PyOmeUnit)
5554)]
5555pub enum UnitsTemperature {
5556    #[serde(rename = "°C")]
5557    C,
5558    #[serde(rename = "°F")]
5559    F,
5560    #[serde(rename = "K")]
5561    K,
5562    #[serde(rename = "°R")]
5563    R,
5564}
5565#[derive(
5566    EnumString,
5567    AsRefStr,
5568    Debug,
5569    strum::Display,
5570    Clone,
5571    Copy,
5572    PartialEq,
5573    Eq,
5574    PartialOrd,
5575    Ord,
5576    Hash,
5577    Deserialize,
5578    Serialize,
5579    VariantNames,
5580    OmeXML,
5581)]
5582#[strum(ascii_case_insensitive)]
5583#[cfg_attr(
5584    feature = "python",
5585    pyclass(
5586        module = "ome_metadata",
5587        from_py_object,
5588        get_all,
5589        set_all,
5590        eq,
5591        frozen,
5592        hash
5593    ),
5594    derive(PyOmeUnit)
5595)]
5596pub enum UnitsTime {
5597    Ys,
5598    Zs,
5599    Es,
5600    Ps,
5601    Ts,
5602    Gs,
5603    Ms,
5604    ks,
5605    hs,
5606    das,
5607    s,
5608    ds,
5609    cs,
5610    ms,
5611    #[serde(rename = "µs")]
5612    us,
5613    ns,
5614    ps,
5615    fs,
5616    r#as,
5617    zs,
5618    ys,
5619    min,
5620    h,
5621    d,
5622}
5623#[cfg_attr(
5624    feature = "python",
5625    pyclass(
5626        module = "ome_metadata",
5627        skip_from_py_object,
5628        get_all,
5629        set_all,
5630        eq,
5631        new = "from_fields"
5632    ),
5633    derive(FromPyObject, PyOme)
5634)]
5635#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5636pub struct Well {
5637    #[serde(rename = "@ID")]
5638    pub id: String,
5639    #[serde(rename = "@Column")]
5640    pub column: i32,
5641    #[serde(rename = "@Row")]
5642    pub row: i32,
5643    #[serde(
5644        default,
5645        rename = "@ExternalDescription",
5646        skip_serializing_if = "Option::is_none"
5647    )]
5648    pub external_description: Option<String>,
5649    #[serde(
5650        default,
5651        rename = "@ExternalIdentifier",
5652        skip_serializing_if = "Option::is_none"
5653    )]
5654    pub external_identifier: Option<String>,
5655    #[serde(default, rename = "@Type", skip_serializing_if = "Option::is_none")]
5656    pub r#type: Option<String>,
5657    #[serde(default = "Well::default_color", rename = "@Color")]
5658    pub color: i32,
5659    #[serde(default, rename = "WellSample", skip_serializing_if = "Vec::is_empty")]
5660    pub well_sample: Vec<WellSample>,
5661    #[serde(
5662        default,
5663        rename = "ReagentRef",
5664        skip_serializing_if = "Option::is_none"
5665    )]
5666    pub reagent_ref: Option<AnnotationRef>,
5667    #[serde(
5668        default,
5669        rename = "AnnotationRef",
5670        skip_serializing_if = "Vec::is_empty"
5671    )]
5672    pub annotation_ref: Vec<AnnotationRef>,
5673}
5674impl Well {
5675    pub fn default_color() -> i32 {
5676        0
5677    }
5678}
5679#[cfg_attr(
5680    feature = "python",
5681    pyclass(
5682        module = "ome_metadata",
5683        skip_from_py_object,
5684        get_all,
5685        set_all,
5686        eq,
5687        new = "from_fields"
5688    ),
5689    derive(FromPyObject, PyOme)
5690)]
5691#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, OmeXML)]
5692pub struct WellSample {
5693    #[serde(rename = "@ID")]
5694    pub id: String,
5695    #[serde(
5696        default,
5697        rename = "@PositionX",
5698        skip_serializing_if = "Option::is_none"
5699    )]
5700    pub position_x: Option<f32>,
5701    #[serde(
5702        default = "WellSample::default_position_x_unit",
5703        rename = "@PositionXUnit"
5704    )]
5705    pub position_x_unit: UnitsLength,
5706    #[serde(
5707        default,
5708        rename = "@PositionY",
5709        skip_serializing_if = "Option::is_none"
5710    )]
5711    pub position_y: Option<f32>,
5712    #[serde(
5713        default = "WellSample::default_position_y_unit",
5714        rename = "@PositionYUnit"
5715    )]
5716    pub position_y_unit: UnitsLength,
5717    #[serde(
5718        default,
5719        rename = "@Timepoint",
5720        skip_serializing_if = "Option::is_none"
5721    )]
5722    pub timepoint: Option<String>,
5723    #[serde(rename = "@Index")]
5724    pub index: i32,
5725    #[serde(default, rename = "ImageRef", skip_serializing_if = "Option::is_none")]
5726    pub image_ref: Option<AnnotationRef>,
5727}
5728impl WellSample {
5729    pub fn default_position_x_unit() -> UnitsLength {
5730        UnitsLength::um
5731    }
5732    pub fn default_position_y_unit() -> UnitsLength {
5733        UnitsLength::um
5734    }
5735}
5736impl Default for WellSample {
5737    fn default() -> Self {
5738        Self {
5739            id: "".to_string(),
5740            position_x: None,
5741            position_x_unit: Self::default_position_x_unit(),
5742            position_y: None,
5743            position_y_unit: Self::default_position_y_unit(),
5744            timepoint: None,
5745            index: 0,
5746            image_ref: None,
5747        }
5748    }
5749}
5750#[cfg_attr(
5751    feature = "python",
5752    pyclass(
5753        module = "ome_metadata",
5754        skip_from_py_object,
5755        get_all,
5756        set_all,
5757        eq,
5758        new = "from_fields"
5759    ),
5760    derive(FromPyObject, PyOme)
5761)]
5762#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5763pub struct XmlAnnotation {
5764    #[serde(rename = "@ID")]
5765    pub id: String,
5766    #[serde(
5767        default,
5768        rename = "@Namespace",
5769        skip_serializing_if = "Option::is_none"
5770    )]
5771    pub namespace: Option<String>,
5772    #[serde(
5773        default,
5774        rename = "@Annotator",
5775        skip_serializing_if = "Option::is_none"
5776    )]
5777    pub annotator: Option<String>,
5778    #[serde(
5779        default,
5780        rename = "Description",
5781        skip_serializing_if = "Option::is_none"
5782    )]
5783    pub description: Option<String>,
5784    #[serde(
5785        default,
5786        rename = "AnnotationRef",
5787        skip_serializing_if = "Vec::is_empty"
5788    )]
5789    pub annotation_ref: Vec<AnnotationRef>,
5790    #[serde(rename = "Value")]
5791    pub value: XmlAnnotationValue,
5792}
5793#[cfg_attr(
5794    feature = "python",
5795    pyclass(module = "ome_metadata", skip_from_py_object, eq, new = "from_fields")
5796)]
5797#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, OmeXML)]
5798pub struct XmlAnnotationValue;
5799pub trait Convert: PartialEq {
5800    /// conversion factor between this and SI value
5801    fn as_si(&self) -> Result<f64, Error>;
5802
5803    /// convert a value with this unit into another unit
5804    fn convert(&self, unit: &Self, value: f64) -> Result<f64, Error> {
5805        if self == unit {
5806            Ok(value)
5807        } else {
5808            Ok(value * self.as_si()? / unit.as_si()?)
5809        }
5810    }
5811}
5812
5813impl Convert for UnitsElectricPotential {
5814    fn as_si(&self) -> Result<f64, Error> {
5815        match self {
5816            UnitsElectricPotential::YV => Ok(1e24),
5817            UnitsElectricPotential::ZV => Ok(1e21),
5818            UnitsElectricPotential::EV => Ok(1e18),
5819            UnitsElectricPotential::PV => Ok(1e15),
5820            UnitsElectricPotential::TV => Ok(1e12),
5821            UnitsElectricPotential::GV => Ok(1e9),
5822            UnitsElectricPotential::MV => Ok(1e6),
5823            UnitsElectricPotential::kV => Ok(1e3),
5824            UnitsElectricPotential::hV => Ok(1e2),
5825            UnitsElectricPotential::daV => Ok(1e1),
5826            UnitsElectricPotential::V => Ok(1e0),
5827            UnitsElectricPotential::dV => Ok(1e-1),
5828            UnitsElectricPotential::cV => Ok(1e-2),
5829            UnitsElectricPotential::mV => Ok(1e-3),
5830            UnitsElectricPotential::uV => Ok(1e-6),
5831            UnitsElectricPotential::nV => Ok(1e-9),
5832            UnitsElectricPotential::pV => Ok(1e-12),
5833            UnitsElectricPotential::fV => Ok(1e-15),
5834            UnitsElectricPotential::aV => Ok(1e-18),
5835            UnitsElectricPotential::zV => Ok(1e-21),
5836            UnitsElectricPotential::yV => Ok(1e-24),
5837        }
5838    }
5839}
5840
5841impl Convert for UnitsFrequency {
5842    fn as_si(&self) -> Result<f64, Error> {
5843        match self {
5844            UnitsFrequency::YHz => Ok(1e24),
5845            UnitsFrequency::ZHz => Ok(1e21),
5846            UnitsFrequency::EHz => Ok(1e18),
5847            UnitsFrequency::PHz => Ok(1e15),
5848            UnitsFrequency::THz => Ok(1e12),
5849            UnitsFrequency::GHz => Ok(1e9),
5850            UnitsFrequency::MHz => Ok(1e6),
5851            UnitsFrequency::kHz => Ok(1e3),
5852            UnitsFrequency::hHz => Ok(1e2),
5853            UnitsFrequency::daHz => Ok(1e1),
5854            UnitsFrequency::Hz => Ok(1e0),
5855            UnitsFrequency::dHz => Ok(1e-1),
5856            UnitsFrequency::cHz => Ok(1e-2),
5857            UnitsFrequency::mHz => Ok(1e-3),
5858            UnitsFrequency::uHz => Ok(1e-6),
5859            UnitsFrequency::nHz => Ok(1e-9),
5860            UnitsFrequency::pHz => Ok(1e-12),
5861            UnitsFrequency::fHz => Ok(1e-15),
5862            UnitsFrequency::aHz => Ok(1e-18),
5863            UnitsFrequency::zHz => Ok(1e-21),
5864            UnitsFrequency::yHz => Ok(1e-24),
5865        }
5866    }
5867}
5868
5869impl Convert for UnitsLength {
5870    fn as_si(&self) -> Result<f64, Error> {
5871        match self {
5872            UnitsLength::Ym => Ok(1e24),
5873            UnitsLength::Zm => Ok(1e21),
5874            UnitsLength::Em => Ok(1e18),
5875            UnitsLength::Pm => Ok(1e15),
5876            UnitsLength::Tm => Ok(1e12),
5877            UnitsLength::Gm => Ok(1e9),
5878            UnitsLength::Mm => Ok(1e6),
5879            UnitsLength::km => Ok(1e3),
5880            UnitsLength::hm => Ok(1e2),
5881            UnitsLength::dam => Ok(1e1),
5882            UnitsLength::m => Ok(1e0),
5883            UnitsLength::dm => Ok(1e-1),
5884            UnitsLength::cm => Ok(1e-2),
5885            UnitsLength::mm => Ok(1e-3),
5886            UnitsLength::um => Ok(1e-6),
5887            UnitsLength::nm => Ok(1e-9),
5888            UnitsLength::pm => Ok(1e-12),
5889            UnitsLength::fm => Ok(1e-15),
5890            UnitsLength::am => Ok(1e-18),
5891            UnitsLength::zm => Ok(1e-21),
5892            UnitsLength::ym => Ok(1e-24),
5893            UnitsLength::A => Ok(1e-10),
5894            UnitsLength::Thou => Ok(2.54e-5),
5895            UnitsLength::Li => Ok(5e2),
5896            UnitsLength::In => Ok(2.54e-2),
5897            UnitsLength::Ft => Ok(3.05e-1),
5898            UnitsLength::Yd => Ok(9.14e-1),
5899            UnitsLength::Mi => Ok(1.609344e3),
5900            UnitsLength::Ua => Ok(1.496e11),
5901            UnitsLength::Ly => Ok(9.461e15),
5902            UnitsLength::Pc => Ok(3.086e16),
5903            UnitsLength::Pt => Ok(3.52778e-4),
5904            UnitsLength::Pixel => Err(Error::SizeOfUnknown("pixel".to_string())),
5905            UnitsLength::ReferenceFrame => Err(Error::SizeOfUnknown("reference frame".to_string())),
5906        }
5907    }
5908}
5909
5910impl Convert for UnitsPower {
5911    fn as_si(&self) -> Result<f64, Error> {
5912        match self {
5913            UnitsPower::YW => Ok(1e24),
5914            UnitsPower::ZW => Ok(1e21),
5915            UnitsPower::EW => Ok(1e18),
5916            UnitsPower::PW => Ok(1e15),
5917            UnitsPower::TW => Ok(1e12),
5918            UnitsPower::GW => Ok(1e9),
5919            UnitsPower::MW => Ok(1e6),
5920            UnitsPower::kW => Ok(1e3),
5921            UnitsPower::hW => Ok(1e2),
5922            UnitsPower::daW => Ok(1e1),
5923            UnitsPower::W => Ok(1e0),
5924            UnitsPower::dW => Ok(1e-1),
5925            UnitsPower::cW => Ok(1e-2),
5926            UnitsPower::mW => Ok(1e-3),
5927            UnitsPower::uW => Ok(1e-6),
5928            UnitsPower::nW => Ok(1e-9),
5929            UnitsPower::pW => Ok(1e-12),
5930            UnitsPower::fW => Ok(1e-15),
5931            UnitsPower::aW => Ok(1e-18),
5932            UnitsPower::zW => Ok(1e-21),
5933            UnitsPower::yW => Ok(1e-24),
5934        }
5935    }
5936}
5937
5938impl Convert for UnitsPressure {
5939    fn as_si(&self) -> Result<f64, Error> {
5940        match self {
5941            UnitsPressure::YPa => Ok(1e24),
5942            UnitsPressure::ZPa => Ok(1e21),
5943            UnitsPressure::EPa => Ok(1e18),
5944            UnitsPressure::PPa => Ok(1e15),
5945            UnitsPressure::TPa => Ok(1e12),
5946            UnitsPressure::GPa => Ok(1e9),
5947            UnitsPressure::MPa => Ok(1e6),
5948            UnitsPressure::kPa => Ok(1e3),
5949            UnitsPressure::hPa => Ok(1e2),
5950            UnitsPressure::daPa => Ok(1e1),
5951            UnitsPressure::Pa => Ok(1e0),
5952            UnitsPressure::dPa => Ok(1e-1),
5953            UnitsPressure::cPa => Ok(1e-2),
5954            UnitsPressure::mPa => Ok(1e-3),
5955            UnitsPressure::uPa => Ok(1e-6),
5956            UnitsPressure::nPa => Ok(1e-9),
5957            UnitsPressure::pPa => Ok(1e-12),
5958            UnitsPressure::fPa => Ok(1e-15),
5959            UnitsPressure::aPa => Ok(1e-18),
5960            UnitsPressure::zPa => Ok(1e-21),
5961            UnitsPressure::yPa => Ok(1e-24),
5962            UnitsPressure::bar => Ok(1e5),
5963            UnitsPressure::Mbar => Ok(1e11),
5964            UnitsPressure::kbar => Ok(1e8),
5965            UnitsPressure::dbar => Ok(1e4),
5966            UnitsPressure::cbar => Ok(1e3),
5967            UnitsPressure::mbar => Ok(1e2),
5968            UnitsPressure::atm => Ok(1.01325e5),
5969            UnitsPressure::psi => Ok(6.89476e3),
5970            UnitsPressure::Torr => Ok(1.33322e3),
5971            UnitsPressure::mTorr => Ok(1.33322),
5972            UnitsPressure::mmHg => Ok(1.33322e2),
5973        }
5974    }
5975}
5976
5977impl Convert for UnitsTemperature {
5978    fn as_si(&self) -> Result<f64, Error> {
5979        match self {
5980            UnitsTemperature::C => Err(Error::TemparatureConversion),
5981            UnitsTemperature::F => Err(Error::TemparatureConversion),
5982            UnitsTemperature::K => Ok(1e1),
5983            UnitsTemperature::R => Ok(5f64 / 9f64),
5984        }
5985    }
5986
5987    fn convert(&self, unit: &Self, value: f64) -> Result<f64, Error> {
5988        match (self, unit) {
5989            (UnitsTemperature::F, UnitsTemperature::C) => Ok((value - 32.) * 5. / 9.),
5990            (UnitsTemperature::K, UnitsTemperature::C) => Ok(value - 273.15),
5991            (UnitsTemperature::R, UnitsTemperature::C) => Ok((value * 5. / 9.) - 273.15),
5992            (UnitsTemperature::C, UnitsTemperature::F) => Ok((value * 9. / 5.) + 32.),
5993            (UnitsTemperature::K, UnitsTemperature::F) => Ok((value * 9. / 5.) - 459.67),
5994            (UnitsTemperature::R, UnitsTemperature::F) => Ok(value - 459.67),
5995            (UnitsTemperature::C, UnitsTemperature::K) => Ok(value + 273.15),
5996            (UnitsTemperature::F, UnitsTemperature::K) => Ok((value + 459.67) * 5. / 9.),
5997            (UnitsTemperature::R, UnitsTemperature::K) => Ok(value * 5. / 9.),
5998            (UnitsTemperature::C, UnitsTemperature::R) => Ok((value + 273.15) * 9. / 5.),
5999            (UnitsTemperature::F, UnitsTemperature::R) => Ok(value + 459.67),
6000            (UnitsTemperature::K, UnitsTemperature::R) => Ok(value * 9. / 5.),
6001            _ => Ok(value),
6002        }
6003    }
6004}
6005
6006impl Convert for UnitsTime {
6007    fn as_si(&self) -> Result<f64, Error> {
6008        match self {
6009            UnitsTime::Ys => Ok(1e24),
6010            UnitsTime::Zs => Ok(1e21),
6011            UnitsTime::Es => Ok(1e18),
6012            UnitsTime::Ps => Ok(1e15),
6013            UnitsTime::Ts => Ok(1e12),
6014            UnitsTime::Gs => Ok(1e9),
6015            UnitsTime::Ms => Ok(1e6),
6016            UnitsTime::ks => Ok(1e3),
6017            UnitsTime::hs => Ok(1e2),
6018            UnitsTime::das => Ok(1e1),
6019            UnitsTime::s => Ok(1e0),
6020            UnitsTime::ds => Ok(1e-1),
6021            UnitsTime::cs => Ok(1e-2),
6022            UnitsTime::ms => Ok(1e-3),
6023            UnitsTime::us => Ok(1e-6),
6024            UnitsTime::ns => Ok(1e-9),
6025            UnitsTime::ps => Ok(1e-12),
6026            UnitsTime::fs => Ok(1e-15),
6027            UnitsTime::r#as => Ok(1e-18),
6028            UnitsTime::zs => Ok(1e-21),
6029            UnitsTime::ys => Ok(1e-24),
6030            UnitsTime::min => Ok(6e1),
6031            UnitsTime::h => Ok(3.6e2),
6032            UnitsTime::d => Ok(8.64e4),
6033        }
6034    }
6035}