Skip to content

Commit

Permalink
Flexible dimension ordering (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliddell authored Apr 1, 2024
1 parent 21948cf commit c245899
Show file tree
Hide file tree
Showing 7 changed files with 522 additions and 569 deletions.
4 changes: 2 additions & 2 deletions drivers.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"acquire-driver-zarr": "0.1.9",
"acquire-driver-zarr": "0.1.10",
"acquire-driver-egrabber": "0.1.5",
"acquire-driver-hdcam": "0.1.9",
"acquire-driver-spinnaker": "0.1.1",
"acquire-driver-pvcam": "0.1.0"
"acquire-driver-pvcam": "0.1.1"
}
107 changes: 71 additions & 36 deletions python/acquire/acquire.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AvailableData:
class Camera:
identifier: Optional[DeviceIdentifier]
settings: CameraProperties

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -43,6 +44,7 @@ class CameraCapabilities:
supported_pixel_types: List[SampleType]
digital_lines: DigitalLineCapabilities
triggers: TriggerCapabilities

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -56,35 +58,52 @@ class CameraProperties:
shape: Tuple[int, int]
input_triggers: InputTriggers
output_triggers: OutputTriggers

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class Capabilities:
video: Tuple[VideoStreamCapabilities, VideoStreamCapabilities]

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

@final
class ChunkDims:
width: int
height: int
planes: int
def dict(self) -> Dict[str, Any]: ...
class DimensionType:
"""The storage dimension type.
@final
class ChunkingCapabilities:
is_supported: bool
width: Property
height: Property
planes: Property
def dict(self) -> Dict[str, Any]: ...
Space: spatial dimension.
Channel: color channel dimension.
Time: time dimension.
Other: other dimension.
When downsampling, Space and Time dimensions are downsampled by the same factor.
Channel and Other dimensions are not downsampled.
This value is also reflected in the dimension metadata of an OME-Zarr dataset.
"""

Space: ClassVar[DimensionType]
Channel: ClassVar[DimensionType]
Time: ClassVar[DimensionType]
Other: ClassVar[DimensionType]

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __int__(self) -> int: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class DeviceIdentifier:
id: Tuple[int, int]
kind: DeviceKind
name: str

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...
@staticmethod
Expand All @@ -103,6 +122,7 @@ class DeviceKind:
Signals: ClassVar[DeviceKind]
StageAxis: ClassVar[DeviceKind]
Storage: ClassVar[DeviceKind]

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
Expand Down Expand Up @@ -131,6 +151,7 @@ class DeviceState:
AwaitingConfiguration: ClassVar[DeviceState]
Armed: ClassVar[DeviceState]
Running: ClassVar[DeviceState]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -143,12 +164,14 @@ class DeviceState:
class DigitalLineCapabilities:
line_count: int
names: Tuple[str, str, str, str, str, str, str, str]

def dict(self) -> Dict[str, Any]: ...

@final
class Direction:
Backward: ClassVar[Direction]
Forward: ClassVar[Direction]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -162,31 +185,30 @@ class InputTriggers:
acquisition_start: Trigger
exposure: Trigger
frame_start: Trigger
def dict(self) -> Dict[str, Any]: ...

@final
class MultiscaleCapabilities:
is_supported: bool
def dict(self) -> Dict[str, Any]: ...

@final
class OffsetShapeCapabilities:
x: Property
y: Property

def dict(self) -> Dict[str, Any]: ...

@final
class OutputTriggers:
exposure: Trigger
frame_start: Trigger
trigger_wait: Trigger

def dict(self) -> Dict[str, Any]: ...

@final
class PID:
derivative: float
integral: float
proportional: float

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -196,6 +218,7 @@ class Property:
low: float
high: float
kind: PropertyType

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -205,6 +228,7 @@ class PropertyType:
FloatingPrecision: ClassVar[PropertyType]
Enum: ClassVar[PropertyType]
String: ClassVar[PropertyType]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -216,6 +240,7 @@ class PropertyType:
@final
class Properties:
video: Tuple[VideoStream, VideoStream]

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -237,6 +262,7 @@ class Runtime:
class SampleRateHz:
numerator: int
denominator: int

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -250,6 +276,7 @@ class SampleType:
U10: ClassVar[SampleType]
U12: ClassVar[SampleType]
U14: ClassVar[SampleType]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -258,25 +285,11 @@ class SampleType:
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

@final
class ShardDims:
width: int
height: int
planes: int
def dict(self) -> Dict[str, Any]: ...

@final
class ShardingCapabilities:
is_supported: bool
width: Property
height: Property
planes: Property
def dict(self) -> Dict[str, Any]: ...

@final
class SignalIOKind:
Input: ClassVar[SignalIOKind]
Output: ClassVar[SignalIOKind]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -289,6 +302,7 @@ class SignalIOKind:
class SignalType:
Analog: ClassVar[SignalType]
Digital: ClassVar[SignalType]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -301,13 +315,25 @@ class SignalType:
class Storage:
identifier: Optional[DeviceIdentifier]
settings: StorageProperties

def dict(self) -> Dict[str, Any]: ...

@final
class StorageCapabilities:
chunk_dims_px: ChunkingCapabilities
shard_dims_chunks: ShardingCapabilities
multiscale: MultiscaleCapabilities
chunking_is_supported: bool
sharding_is_supported: bool
multiscale_is_supported: bool

def dict(self) -> Dict[str, Any]: ...

@final
class StorageDimension:
name: str
kind: DimensionType
array_size_px: int
chunk_size_px: int
shard_size_chunks: int

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -316,9 +342,9 @@ class StorageProperties:
filename: Optional[str]
first_frame_id: int
pixel_scale_um: Tuple[float, float]
chunk_dims_px: ChunkDims
shard_dims_chunks: ShardDims
acquisition_dimensions: List[StorageDimension]
enable_multiscale: bool

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -327,6 +353,7 @@ class Trigger:
enable: bool
line: int
kind: SignalIOKind

def __init__(self, *args: None, **kwargs: Any) -> None: ...
def dict(self) -> Dict[str, Any]: ...

Expand All @@ -335,6 +362,7 @@ class TriggerCapabilities:
acquisition_start: TriggerInputOutputCapabilities
exposure: TriggerInputOutputCapabilities
frame_start: TriggerInputOutputCapabilities

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -345,6 +373,7 @@ class TriggerEdge:
AnyEdge: ClassVar[TriggerEdge]
LevelLow: ClassVar[TriggerEdge]
LevelHigh: ClassVar[TriggerEdge]

def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
Expand All @@ -357,6 +386,7 @@ class TriggerEdge:
class TriggerInputOutputCapabilities:
input: int
output: int

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -368,12 +398,14 @@ class VideoFrame:
class VideoFrameMetadata:
frame_id: int
timestamps: VideoFrameTimestamps

def dict(self) -> Dict[str, Any]: ...

@final
class VideoFrameTimestamps:
hardware: int
acq_thread: int

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -382,6 +414,7 @@ class VideoStream:
storage: Storage
max_frame_count: int
frame_average_count: int

def dict(self) -> Dict[str, Any]: ...

@final
Expand All @@ -390,12 +423,14 @@ class VideoStreamCapabilities:
storage: StorageCapabilities
max_frame_count: Property
frame_average_count: Property

def dict(self) -> Dict[str, Any]: ...

@final
class VoltageRange:
mn: float
mx: float

@overload
def __init__(self) -> None: ...
@overload
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ fn acquire(py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<camera::TriggerInputOutputCapabilities>()?;
m.add_class::<camera::OffsetShapeCapabilities>()?;
m.add_class::<storage::StorageCapabilities>()?;
m.add_class::<storage::ChunkingCapabilities>()?;
m.add_class::<storage::ShardingCapabilities>()?;
m.add_class::<storage::MultiscaleCapabilities>()?;
m.add_class::<components::Property>()?;
m.add_class::<components::PropertyType>()?;

Expand All @@ -91,8 +88,8 @@ fn acquire(py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<camera::CameraProperties>()?;
m.add_class::<camera::InputTriggers>()?;
m.add_class::<camera::OutputTriggers>()?;
m.add_class::<storage::ChunkDims>()?;
m.add_class::<storage::ShardDims>()?;
m.add_class::<storage::DimensionType>()?;
m.add_class::<storage::StorageDimension>()?;
m.add_class::<storage::StorageProperties>()?;

m.add_class::<components::Direction>()?;
Expand Down
Loading

0 comments on commit c245899

Please sign in to comment.