Workflow Engine¶
openlithohub.workflow.parsing
¶
Layout file parsing via KLayout Python API.
parse_layout(path)
¶
Parse an OASIS or GDSII layout file.
Returns dictionary with 'cells', 'layers', 'bounding_box', and '_layout' handle.
Source code in src/openlithohub/workflow/parsing.py
openlithohub.workflow.tiling
¶
Full-chip tiling strategy for distributed processing.
Tile
dataclass
¶
tile_layout(layout_tensor, tile_size=2048, overlap=128)
¶
Partition a full-chip layout tensor into overlapping tiles.
Uses a sliding window with configurable overlap. Boundary tiles are zero-padded to maintain uniform tile dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout_tensor
|
Tensor
|
Full layout as tensor (H, W). |
required |
tile_size
|
int
|
Size of each square tile in pixels. |
2048
|
overlap
|
int
|
Overlap between adjacent tiles for seamless stitching. |
128
|
Returns:
| Type | Description |
|---|---|
list[Tile]
|
List of Tile objects covering the full layout. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If overlap >= tile_size or tile_size <= 0. |
Source code in src/openlithohub/workflow/tiling.py
stitch_tiles(tiles, output_shape)
¶
Reassemble optimized tiles into a full-chip tensor.
Uses linear blending in overlap regions to avoid seam artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tiles
|
list[tuple[Tile, Tensor]]
|
List of (original_tile, optimized_tensor) pairs. |
required |
output_shape
|
tuple[int, int]
|
(H, W) of the full output tensor. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Stitched tensor of shape output_shape. |
Source code in src/openlithohub/workflow/tiling.py
openlithohub.workflow.contour.manhattan
¶
Manhattan (staircase) contour extraction for traditional VSB writers.
extract_manhattan_contour(mask, pixel_size_nm=1.0)
¶
Extract Manhattan (rectilinear) polygon contours from a binary mask.
Traces pixel-edge boundaries between foreground and background regions, producing axis-aligned polygons suitable for VSB mask writers.
The algorithm: 1. Find horizontal and vertical boundary edges between 0/1 pixels 2. Build an adjacency graph of edges sharing vertices 3. Trace closed loops through the edge graph
Vertices are at pixel corners (not pixel centers), scaled by pixel_size_nm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask
|
Tensor
|
Binary mask tensor (H, W). |
required |
pixel_size_nm
|
float
|
Physical pixel size for coordinate scaling. |
1.0
|
Returns:
| Type | Description |
|---|---|
list[list[tuple[float, float]]]
|
List of polygons, each as a list of (x_nm, y_nm) vertices in order. |
list[list[tuple[float, float]]]
|
Outer boundaries are clockwise, holes are counter-clockwise. |
Source code in src/openlithohub/workflow/contour/manhattan.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
openlithohub.workflow.contour.curvilinear
¶
Curvilinear contour extraction and B-spline fitting for OASIS.MBW export.
BSplineCurve
dataclass
¶
fit_bspline(contour_pixels, tolerance_nm=0.5, pixel_size_nm=1.0)
¶
Fit B-spline curves to pixel-level contour data.
If input is a 2D binary mask, extracts boundary contours first. If input is an (N, 2) tensor, treats it as a single ordered point loop.
Source code in src/openlithohub/workflow/contour/curvilinear.py
export_oasis_mbw(curves, output_path, *, format_version='2.1', samples_per_curve=64)
¶
Serialize B-spline curves to OASIS.MBW format for multi-beam writers.
MVP implementation: samples curves to high-resolution polygons and writes a simplified OASIS-compatible binary file with polygon records. Native curve primitives per SEMI P44 are planned for a future release.
Source code in src/openlithohub/workflow/contour/curvilinear.py
openlithohub.workflow.export
¶
OASIS/GDSII export coordination.
export_oasis(mask, output_path, *, mode='curvilinear', pixel_size_nm=1.0)
¶
Export an optimized mask tensor to OASIS format.
For manhattan mode, extracts rectilinear contours and writes via KLayout. For curvilinear mode, fits B-splines and writes OASIS.MBW format.