raygeo.image.scan
ScanLine
A single scan line with its pixel coverage and mm-space endpoints.
Produced by generate_scan_lines. Each line has a unique index, start/end positions in mm, and the set of pixels it intersects in the image.
end_mm
end_mm: tuple[float, float]
index
index: int
line_interval_mm
line_interval_mm: float
pixels
pixels: list[tuple[int, int]]
start_mm
start_mm: tuple[float, float]
direction()
direction() -> tuple[float, float]
| Parameter | Type | Description |
|---|---|---|
| Returns | tuple[float, float] |
length_mm()
length_mm() -> float
| Parameter | Type | Description |
|---|---|---|
| Returns | float |
pixel_to_mm()
pixel_to_mm(
px: int,
py: int,
pixels_per_mm: tuple[float, float],
) -> tuple[float, float]
| Parameter | Type | Description |
|---|---|---|
px | int | |
py | int | |
pixels_per_mm | tuple[float, float] | |
| Returns | tuple[float, float] |
ScanMode
Scan mode for raster operations.
SEGMENTED skips zero-power gaps within a scan line. FULL_SWEEP emits the full line with power
values (zeros included).
Functions
downsample_power_values()
downsample_power_values(
power_values: numpy.ndarray,
start_mm: tuple[float, float],
end_mm: tuple[float, float],
sample_interval_mm: float,
) -> tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
Downsample power values along a scan segment.
If the sample interval is larger than the native pixel spacing, the power values are resampled by nearest-neighbour at the target spacing. Otherwise the original values are returned with their corresponding positions.
| Parameter | Type | Description |
|---|---|---|
power_values | numpy.ndarray | 1-D array of byte power values. |
start_mm | tuple[float, float] | (x, y) start position of the segment in mm. |
end_mm | tuple[float, float] | (x, y) end position of the segment in mm. |
sample_interval_mm | float | Desired sample spacing in mm. |
| Returns | tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] | (power, x_mm, y_mm) of downsampled values. |
| Complexity | O(n) where n = number of power values |