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 simplystr
type 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_refs
bin_data
->bin_data_blocks
dataset_ref
->dataset_refs
emission_filter_ref
->emission_filters
excitation_filter_ref
->excitation_filters
experimenter_ref
->experimenter_refs
folder_ref
->folder_refs
image_ref
->image_refs
leader
->leaders
light_source_settings
->light_source_settings_combinations
m
->ms
microbeam_manipulation_ref
->microbeam_manipulation_refs
plate_ref
->plate_refs
roi_ref
->roi_refs
well_sample_ref
->well_sample_refs
-
Fields types
PositiveInt
,PositiveFloat
,NonNegativeInt
, andNonNegativeFloat
are no longer typed with subclasses of pydanticConstrainedInt
andConstrainedFloat
, but are now simplyint
orfloat
type with field validators. - Many local
Type
enums have been renamed to globally unique names. For examplemodel.detector.Type
is nowmodel.Detector_Type
. For backwards compatibility, the old names are still available as aliases in the corresponding modules. For example,Detector_Type
is aliased asType
in themodel.detector
module. - The
kind
fields that were present onShape
andLightSourceGroup
subclasses have been removed from the models. Thekind
key may still be included in adict
when 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
Enum
and 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_types
module is deprecated and should not be used (import directly frommodel
instead). Names that were previously there are still aliased insimple_types
for backwards compatibility, but code should be updated and a deprecation warning will soon be added.
Changes to ome_types.model
¶
Added classes¶
MetadataOnly
ROI.Union
StructuredAnnotations
Removed classes¶
LightSourceGroup
ShapeGroup
Class Field Changes¶
Annotation
¶
annotation_ref
- name changed toannotation_refs
annotator
- type changed fromOptional[ExperimenterID]
toOptional[ConstrainedStrValue]
Arc
¶
type
- type changed fromOptional[Type]
toOptional[Arc_Type]
BinData
¶
compression
- type changed fromOptional[Compression]
toBinData_Compression
length
- type changed fromint
toConstrainedIntValue
value
- type changed fromstr
tobytes
BinaryFile
¶
size
- type changed fromNonNegativeLong
toConstrainedIntValue
OME.BinaryOnly
¶
uuid
- type changed fromUniversallyUniqueIdentifier
toConstrainedStrValue
Channel
¶
annotation_ref
- name changed toannotation_refs
acquisition_mode
- type changed fromOptional[AcquisitionMode]
toOptional[Channel_AcquisitionMode]
color
- type changed fromOptional[Color]
toColor
contrast_method
- type changed fromOptional[ContrastMethod]
toOptional[Channel_ContrastMethod]
emission_wavelength_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
excitation_wavelength_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
illumination_type
- type changed fromOptional[IlluminationType]
toOptional[Channel_IlluminationType]
pinhole_size_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
Dataset
¶
annotation_ref
- name changed toannotation_refs
image_ref
- name changed toimage_refs
Detector
¶
annotation_ref
- name changed toannotation_refs
type
- type changed fromOptional[Type]
toOptional[Detector_Type]
voltage_unit
- type changed fromOptional[UnitsElectricPotential]
toUnitsElectricPotential
DetectorSettings
¶
read_out_rate_unit
- type changed fromOptional[UnitsFrequency]
toUnitsFrequency
voltage_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_refs
experimenter_ref
- name changed toexperimenter_refs
leader
- name changed toleaders
External
¶
compression
- type changed fromOptional[Compression]
toExternal_Compression
sha1
- type changed fromHex40
tobytes
Filament
¶
type
- type changed fromOptional[Type]
toOptional[Filament_Type]
Filter
¶
annotation_ref
- name changed toannotation_refs
type
- type changed fromOptional[Type]
toOptional[Filter_Type]
FilterSet
¶
emission_filter_ref
- name changed toemission_filters
excitation_filter_ref
- name changed toexcitation_filters
Folder
¶
annotation_ref
- name changed toannotation_refs
folder_ref
- name changed tofolder_refs
image_ref
- name changed toimage_refs
roi_ref
- name changed toroi_refs
Image
¶
annotation_ref
- name changed toannotation_refs
microbeam_manipulation_ref
- name changed tomicrobeam_manipulation_refs
roi_ref
- name changed toroi_refs
ImagingEnvironment
¶
air_pressure_unit
- type changed fromOptional[UnitsPressure]
toUnitsPressure
co2_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]
toUnitsFrequency
type
- type changed fromOptional[Type]
toOptional[Laser_Type]
wavelength_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
LightPath
¶
annotation_ref
- name changed toannotation_refs
emission_filter_ref
- name changed toemission_filters
excitation_filter_ref
- name changed toexcitation_filters
LightSource
¶
annotation_ref
- name changed toannotation_refs
power_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 fromstr
toOptional[str]
Map
¶
m
- name changed toms
MicrobeamManipulation
¶
light_source_settings
- name changed tolight_source_settings_combinations
roi_ref
- name changed toroi_refs
type
- type changed fromList[Type]
toList[MicrobeamManipulation_value]
Microscope
¶
type
- type changed fromOptional[Type]
toOptional[Microscope_Type]
OME
¶
structured_annotations
- type changed fromList[Annotation]
toStructuredAnnotations
uuid
- type changed fromOptional[UniversallyUniqueIdentifier]
toOptional[ConstrainedStrValue]
Objective
¶
annotation_ref
- name changed toannotation_refs
correction
- 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_blocks
dimension_order
- type changed fromDimensionOrder
toPixels_DimensionOrder
metadata_only
- type changed frombool
toOptional[MetadataOnly]
physical_size_x_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
physical_size_y_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
physical_size_z_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
time_increment_unit
- type changed fromOptional[UnitsTime]
toUnitsTime
Plane
¶
annotation_ref
- name changed toannotation_refs
delta_t_unit
- type changed fromOptional[UnitsTime]
toUnitsTime
exposure_time_unit
- type changed fromOptional[UnitsTime]
toUnitsTime
hash_sha1
- type changed fromOptional[Hex40]
toOptional[bytes]
position_x_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
position_y_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
position_z_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
Plate
¶
annotation_ref
- name changed toannotation_refs
well_origin_x_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
well_origin_y_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
PlateAcquisition
¶
annotation_ref
- name changed toannotation_refs
well_sample_ref
- name changed towell_sample_refs
Project
¶
annotation_ref
- name changed toannotation_refs
dataset_ref
- name changed todataset_refs
ROI
¶
annotation_ref
- name changed toannotation_refs
union
- 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_refs
plate_ref
- name changed toplate_refs
Shape
¶
annotation_ref
- name changed toannotation_refs
fill_rule
- type changed fromOptional[FillRule]
toOptional[Shape_FillRule]
font_family
- type changed fromOptional[FontFamily]
toOptional[Shape_FontFamily]
font_size_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
font_style
- type changed fromOptional[FontStyle]
toOptional[Shape_FontStyle]
stroke_width_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
StageLabel
¶
x_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
y_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
z_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]
toUnitsLength
cut_in_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
cut_out_tolerance_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
cut_out_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
transmittance
- type changed fromOptional[PercentFraction]
toOptional[ConstrainedFloatValue]
TiffData.UUID
¶
file_name
- type changed fromstr
toOptional[str]
value
- type changed fromUniversallyUniqueIdentifier
toConstrainedStrValue
XMLAnnotation.Value
¶
Well
¶
annotation_ref
- name changed toannotation_refs
color
- type changed fromOptional[Color]
toColor
WellSample
¶
position_x_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
position_y_unit
- type changed fromOptional[UnitsLength]
toUnitsLength
XMLAnnotation
¶
value
- type changed fromElement
toValue