Migration guide¶
v0.4.0 was a major release and a complete rewrite of the code-generation
part of the library: ome-types is now generated using
xsdata.
Much effort has been made to keep all existing APIs working, but you may encounter a number of deprecation warnings. This guide will help you migrate your code to the new version.
General Changes¶
Read these first
- All IDs are no longer subclasses of
LSID, but are now simplystrtype with a pydantic regex validator. -
Many plural names have been updated, such as
annotation_ref->annotation_refs. The old names still work in__init__methods and as attributes on instances, but will emit a deprecation warning.List of plural name changes These fields appear in many different classes:
annotation_ref->annotation_refsbin_data->bin_data_blocksdataset_ref->dataset_refsemission_filter_ref->emission_filtersexcitation_filter_ref->excitation_filtersexperimenter_ref->experimenter_refsfolder_ref->folder_refsimage_ref->image_refsleader->leaderslight_source_settings->light_source_settings_combinationsm->msmicrobeam_manipulation_ref->microbeam_manipulation_refsplate_ref->plate_refsroi_ref->roi_refswell_sample_ref->well_sample_refs
-
Fields types
PositiveInt,PositiveFloat,NonNegativeInt, andNonNegativeFloatare no longer typed with subclasses of pydanticConstrainedIntandConstrainedFloat, but are now simplyintorfloattype with field validators. - Many local
Typeenums have been renamed to globally unique names. For examplemodel.detector.Typeis nowmodel.Detector_Type. For backwards compatibility, the old names are still available as aliases in the corresponding modules. For example,Detector_Typeis aliased asTypein themodel.detectormodule. - The
kindfields that were present onShapeandLightSourceGroupsubclasses have been removed from the models. Thekindkey may still be included in adictwhen instantiating a subclass, but the name will not be available on the model. (This was not an OME field to begin with, it was a workaround for serialization/deserialization todict.) - Many fields that take an
Enumand have a default value have had their types changed fromOptional[EnumType]toEnumType. For example fields typed asOptional[UnitsLength]for which a default value is specified are now typed asUnitsLength. - The
ome_types.model.simple_typesmodule is deprecated and should not be used (import directly frommodelinstead). Names that were previously there are still aliased insimple_typesfor backwards compatibility, but code should be updated and a deprecation warning will soon be added.
Changes to ome_types.model¶
Added classes¶
MetadataOnlyROI.UnionStructuredAnnotations
Removed classes¶
LightSourceGroupShapeGroup
Class Field Changes¶
Annotation¶
annotation_ref- name changed toannotation_refsannotator- type changed fromOptional[ExperimenterID]toOptional[ConstrainedStrValue]
Arc¶
type- type changed fromOptional[Type]toOptional[Arc_Type]
BinData¶
compression- type changed fromOptional[Compression]toBinData_Compressionlength- type changed frominttoConstrainedIntValuevalue- type changed fromstrtobytes
BinaryFile¶
size- type changed fromNonNegativeLongtoConstrainedIntValue
OME.BinaryOnly¶
uuid- type changed fromUniversallyUniqueIdentifiertoConstrainedStrValue
Channel¶
annotation_ref- name changed toannotation_refsacquisition_mode- type changed fromOptional[AcquisitionMode]toOptional[Channel_AcquisitionMode]color- type changed fromOptional[Color]toColorcontrast_method- type changed fromOptional[ContrastMethod]toOptional[Channel_ContrastMethod]emission_wavelength_unit- type changed fromOptional[UnitsLength]toUnitsLengthexcitation_wavelength_unit- type changed fromOptional[UnitsLength]toUnitsLengthillumination_type- type changed fromOptional[IlluminationType]toOptional[Channel_IlluminationType]pinhole_size_unit- type changed fromOptional[UnitsLength]toUnitsLength
Dataset¶
annotation_ref- name changed toannotation_refsimage_ref- name changed toimage_refs
Detector¶
annotation_ref- name changed toannotation_refstype- type changed fromOptional[Type]toOptional[Detector_Type]voltage_unit- type changed fromOptional[UnitsElectricPotential]toUnitsElectricPotential
DetectorSettings¶
read_out_rate_unit- type changed fromOptional[UnitsFrequency]toUnitsFrequencyvoltage_unit- type changed fromOptional[UnitsElectricPotential]toUnitsElectricPotential
Dichroic¶
annotation_ref- name changed toannotation_refs
Experiment¶
type- type changed fromList[Type]toList[Experiment_value]
Experimenter¶
annotation_ref- name changed toannotation_refs
ExperimenterGroup¶
annotation_ref- name changed toannotation_refsexperimenter_ref- name changed toexperimenter_refsleader- name changed toleaders
External¶
compression- type changed fromOptional[Compression]toExternal_Compressionsha1- type changed fromHex40tobytes
Filament¶
type- type changed fromOptional[Type]toOptional[Filament_Type]
Filter¶
annotation_ref- name changed toannotation_refstype- type changed fromOptional[Type]toOptional[Filter_Type]
FilterSet¶
emission_filter_ref- name changed toemission_filtersexcitation_filter_ref- name changed toexcitation_filters
Folder¶
annotation_ref- name changed toannotation_refsfolder_ref- name changed tofolder_refsimage_ref- name changed toimage_refsroi_ref- name changed toroi_refs
Image¶
annotation_ref- name changed toannotation_refsmicrobeam_manipulation_ref- name changed tomicrobeam_manipulation_refsroi_ref- name changed toroi_refs
ImagingEnvironment¶
air_pressure_unit- type changed fromOptional[UnitsPressure]toUnitsPressureco2_percent- type changed fromOptional[PercentFraction]toOptional[ConstrainedFloatValue]humidity- type changed fromOptional[PercentFraction]toOptional[ConstrainedFloatValue]temperature_unit- type changed fromOptional[UnitsTemperature]toUnitsTemperature
Instrument¶
light_source_group- name removedarcs- name addedfilaments- name addedgeneric_excitation_sources- name addedlasers- name addedlight_emitting_diodes- name addedannotation_ref- name changed toannotation_refs
Laser¶
laser_medium- type changed fromOptional[LaserMedium]toOptional[Laser_LaserMedium]pulse- type changed fromOptional[Pulse]toOptional[Laser_Pulse]repetition_rate_unit- type changed fromOptional[UnitsFrequency]toUnitsFrequencytype- type changed fromOptional[Type]toOptional[Laser_Type]wavelength_unit- type changed fromOptional[UnitsLength]toUnitsLength
LightPath¶
annotation_ref- name changed toannotation_refsemission_filter_ref- name changed toemission_filtersexcitation_filter_ref- name changed toexcitation_filters
LightSource¶
annotation_ref- name changed toannotation_refspower_unit- type changed fromOptional[UnitsPower]toUnitsPower
LightSourceSettings¶
attenuation- type changed fromOptional[PercentFraction]toOptional[ConstrainedFloatValue]wavelength_unit- type changed fromOptional[UnitsLength]toUnitsLength
Map.M¶
k- type changed fromstrtoOptional[str]
Map¶
m- name changed toms
MicrobeamManipulation¶
light_source_settings- name changed tolight_source_settings_combinationsroi_ref- name changed toroi_refstype- type changed fromList[Type]toList[MicrobeamManipulation_value]
Microscope¶
type- type changed fromOptional[Type]toOptional[Microscope_Type]
OME¶
structured_annotations- type changed fromList[Annotation]toStructuredAnnotationsuuid- type changed fromOptional[UniversallyUniqueIdentifier]toOptional[ConstrainedStrValue]
Objective¶
annotation_ref- name changed toannotation_refscorrection- type changed fromOptional[Correction]toOptional[Objective_Correction]immersion- type changed fromOptional[Immersion]toOptional[Objective_Immersion]working_distance_unit- type changed fromOptional[UnitsLength]toUnitsLength
ObjectiveSettings¶
medium- type changed fromOptional[Medium]toOptional[ObjectiveSettings_Medium]
Pixels¶
bin_data- name changed tobin_data_blocksdimension_order- type changed fromDimensionOrdertoPixels_DimensionOrdermetadata_only- type changed frombooltoOptional[MetadataOnly]physical_size_x_unit- type changed fromOptional[UnitsLength]toUnitsLengthphysical_size_y_unit- type changed fromOptional[UnitsLength]toUnitsLengthphysical_size_z_unit- type changed fromOptional[UnitsLength]toUnitsLengthtime_increment_unit- type changed fromOptional[UnitsTime]toUnitsTime
Plane¶
annotation_ref- name changed toannotation_refsdelta_t_unit- type changed fromOptional[UnitsTime]toUnitsTimeexposure_time_unit- type changed fromOptional[UnitsTime]toUnitsTimehash_sha1- type changed fromOptional[Hex40]toOptional[bytes]position_x_unit- type changed fromOptional[UnitsLength]toUnitsLengthposition_y_unit- type changed fromOptional[UnitsLength]toUnitsLengthposition_z_unit- type changed fromOptional[UnitsLength]toUnitsLength
Plate¶
annotation_ref- name changed toannotation_refswell_origin_x_unit- type changed fromOptional[UnitsLength]toUnitsLengthwell_origin_y_unit- type changed fromOptional[UnitsLength]toUnitsLength
PlateAcquisition¶
annotation_ref- name changed toannotation_refswell_sample_ref- name changed towell_sample_refs
Project¶
annotation_ref- name changed toannotation_refsdataset_ref- name changed todataset_refs
ROI¶
annotation_ref- name changed toannotation_refsunion- type changed fromList[Union[Rectangle, Mask, Point, Ellipse, Line, Polyline, Polygon, Label]]toShapeUnion
Reagent¶
annotation_ref- name changed toannotation_refs
Screen¶
annotation_ref- name changed toannotation_refsplate_ref- name changed toplate_refs
Shape¶
annotation_ref- name changed toannotation_refsfill_rule- type changed fromOptional[FillRule]toOptional[Shape_FillRule]font_family- type changed fromOptional[FontFamily]toOptional[Shape_FontFamily]font_size_unit- type changed fromOptional[UnitsLength]toUnitsLengthfont_style- type changed fromOptional[FontStyle]toOptional[Shape_FontStyle]stroke_width_unit- type changed fromOptional[UnitsLength]toUnitsLength
StageLabel¶
x_unit- type changed fromOptional[UnitsLength]toUnitsLengthy_unit- type changed fromOptional[UnitsLength]toUnitsLengthz_unit- type changed fromOptional[UnitsLength]toUnitsLength
StructuredAnnotations¶
boolean_annotations- type changed fromOptional[BooleanAnnotation]toList[BooleanAnnotation]comment_annotations- type changed fromOptional[CommentAnnotation]toList[CommentAnnotation]double_annotations- type changed fromOptional[DoubleAnnotation]toList[DoubleAnnotation]file_annotations- type changed fromOptional[FileAnnotation]toList[FileAnnotation]list_annotations- type changed fromOptional[ListAnnotation]toList[ListAnnotation]long_annotations- type changed fromOptional[LongAnnotation]toList[LongAnnotation]map_annotations- type changed fromOptional[MapAnnotation]toList[MapAnnotation]tag_annotations- type changed fromOptional[TagAnnotation]toList[TagAnnotation]term_annotations- type changed fromOptional[TermAnnotation]toList[TermAnnotation]timestamp_annotations- type changed fromOptional[TimestampAnnotation]toList[TimestampAnnotation]xml_annotations- type changed fromOptional[XMLAnnotation]toList[XMLAnnotation]
TransmittanceRange¶
cut_in_tolerance_unit- type changed fromOptional[UnitsLength]toUnitsLengthcut_in_unit- type changed fromOptional[UnitsLength]toUnitsLengthcut_out_tolerance_unit- type changed fromOptional[UnitsLength]toUnitsLengthcut_out_unit- type changed fromOptional[UnitsLength]toUnitsLengthtransmittance- type changed fromOptional[PercentFraction]toOptional[ConstrainedFloatValue]
TiffData.UUID¶
file_name- type changed fromstrtoOptional[str]value- type changed fromUniversallyUniqueIdentifiertoConstrainedStrValue
XMLAnnotation.Value¶
Well¶
annotation_ref- name changed toannotation_refscolor- type changed fromOptional[Color]toColor
WellSample¶
position_x_unit- type changed fromOptional[UnitsLength]toUnitsLengthposition_y_unit- type changed fromOptional[UnitsLength]toUnitsLength
XMLAnnotation¶
value- type changed fromElementtoValue