IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
metadata_key.py
Go to the documentation of this file.
1from dataclasses import dataclass
2from enum import Enum
3from typing import Type, Any
4
6
7
8@dataclass(frozen=True)
10 string_value: str
11 type: Type[Any]
12
13
14class MetadataKey(Enum):
15 """!
16 @brief
17 Enumerates all compile-time known metadata keys.
18
19 Each enum value carries both:
20 - A string identifier (used internally in Metadata).
21 - The expected Python type of its value.
22
23 This makes it easy to use type-safe keys without an extra trait class.
24
25 Example::
26
27 key = MetadataKey.DEVICE_TIMESTAMP
28 print(key.string_value) # outputs: device_timestamp
29 print(key.type) # outputs: <class 'int'>
30
31 @ingroup ids_peak_common_python_types
32 """
33
34 DEVICE_TIMESTAMP = _MetadataKeyInfo("DeviceTimestamp", int)
35 """!
36 @brief
37 Device-provided image acquisition timestamp in nanoseconds.
38
39 The timestamp is expressed in nanoseconds and is relative to an
40 unspecified reference point (t = 0). It does not represent an
41 absolute wall-clock time, but instead the elapsed time since
42 that reference. The difference between timestamps of consecutive
43 images indicates the time interval between their recordings.
44 """
45
46 DEVICE_FRAME_ID = _MetadataKeyInfo("DeviceFrameID", int)
47 """!
48 @brief
49 A sequentially incremented identifier for the frame.
50
51 The frame ID is a sequentially incremented value that increases by one
52 from one frame to the next. It serves as a means to detect missing or
53 out-of-order frames in a stream. Once the maximum value supported by
54 the underlying technology is reached, the frame ID wraps back to zero.
55 The exact wrap-around point is not fixed and depends on the implementation.
56 """
57
58 BINNING_HORIZONTAL = _MetadataKeyInfo("BinningHorizontal", int)
59 """!
60 @brief
61 Horizontal pixel binning factor.
62
63 Indicates how many adjacent pixels are combined horizontally.
64 """
65
66 BINNING_VERTICAL = _MetadataKeyInfo("BinningVertical", int)
67 """!
68 @brief
69 Vertical pixel binning factor.
70
71 Indicates how many adjacent pixels are combined vertically.
72 """
73
74 ROI = _MetadataKeyInfo("Roi", Rectangle)
75 """!
76 @brief
77 Region of interest applied to the image.
78
79 Defines the rectangular area of the image that remains after
80 processing steps such as cropping or scaling were applied.
81 Coordinates and dimensions are expressed in pixels.
82 """
83
84 DEVICE_EXPOSURE_TIME = _MetadataKeyInfo("DeviceExposureTime", float)
85 """!
86 @brief
87 Device exposure time the image was captured with.
88
89 Specified in microseconds (µs).
90 """
91
92 @property
93 def string_value(self) -> str:
94 """!
95 @brief Return the string_value for this metadata key."""
96 return self.value.string_value
97
98 @property
99 def type(self) -> Type[Any]:
100 """!
101 @brief Return the expected Python type for this metadata key."""
102 return self.value.type
103
104 def __str__(self) -> str:
105 """!
106 @brief
107 Return a human-readable string of the MetadataKey object.
108 """
109 return f"{self.string_value} ({self.type.__name__})"
110
111 def __repr__(self) -> str:
112 """!
113 @brief
114 Return an unambiguous string of the MetadataKey object.
115 """
116 return (f"{self.__class__.__name__}.{self.name}"
117 f"(string_value={self.value.string_value!r}, "
118 f"type={self.value.type!r})")
Enumerates all compile-time known metadata keys.
Type[Any] type(self)
Return the expected Python type for this metadata key.
str string_value(self)
Return the string_value for this metadata key.
str __str__(self)
Return a human-readable string of the MetadataKey object.
str __repr__(self)
Return an unambiguous string of the MetadataKey object.