TRACE pipeline map
Click a box to highlight its outgoing arrows. Click again or off-box to clear.
Drag to pan, scroll to zoom, press
R
to reset view.
User input
Bundled with TRACE
TRACE Stage 1 — preprocessing
Intermediate artifacts
TRACE Stage 2 — identifyFeatures
WingResult
Outputs
(when isolation off)
isolated image
ROI
vein_polys
landmarks
wing_outline
SkeletonGraph
skeleton
anchored
landmarks
wing_axis
split polys + veins
veins
regions
custom distances
Wing image
• Standard: tif / tiff / bmp / png / jpg / jpeg
• Adobe: psd / psb
• Modern: heic / heif / svg
• Camera RAW: dng / nef / cr2 / cr3 / arw / raf / orf / pef / rw2 / srw / raw
• Microscopy: czi / nd2 / lif / lsm (→ OME-TIFF)
Wing isolation model dir
• weights + metadata.json (optional)
Landmark model
• ResNet18 U-Net checkpoint (.pt)
Segmentation model dir
• weights + metadata.json
PipelineConfig
• JSON / GUI
Stage 1: Resolution adjust
• Compare input µm/px to model's training µm/px
• Skip if ratio is inside tolerance band
• Otherwise rescale image toward target µm/px
• Geometry is inverse-rescaled after Stage 2 (identifyFeatures)
Stage 2: Wing isolation (optional)
• Run wing-isolation model → wing polygon
• Buffer polygon by wing_expand_fraction
• Mask non-wing pixels to 0
• Write isolated image + wing.geojson
Stage 3: Landmark detection
• Load LandmarkPredictor (cached)
• Heatmap regression inference
• Extract peak coordinates
• Map names → GeoJSON schema
• Write landmarks.geojson
Stage 4: Hinge chop
• Load landmarks from Stage 3
• Build hinge polyline from distal-margin landmarks
• Build proximal mask
• Black out hinge pixels (in place, no translation)
• Write chopped image (temp)
Stage 5: Segmentation
• Load seg model + metadata (cached)
• Read RGB uint8
• Tiled inference w/ center-crop stitch
• Optional ROI from wing.geojson (skips background tiles)
• Per-channel normalization
• Gaussian smooth probabilities
• Argmax → class mask
• Polygonize mask → features
• Save detection.geojson
Stage 6: Wing rotation (optional)
• Fit affine from reliable landmarks
• Rotate un-masked image to canonical orientation
• Apply same affine to every produced GeoJSON (in-place)
• Optional mirror-correct for opposite-chirality wings
• → rotated GeoJSONs feed identifyFeatures + overlay renders
wing.geojson
• single 'wing' feature (Stage 2)
landmarks.geojson
• Point features
chopped image
• temp; deleted unless --keep-intermediates
detection.geojson
• vein + intervein polygons
Step 1: Parse inputs
• Load vein / intervein polys
• Snap raw landmarks
• Compute wing outline (union)
• Estimate image_shape
Step 2: Build skeleton graph
• Rasterize vein polys → vein_mask
• Boundary smoothing (optional)
• Skeletonize (RIDGE / medial-axis / …)
• Prune (distance-map / multi-scale)
• Collinear edge merge
• Gap bridging — pass 1 / 2 / 3
• Compute median_vein_width_px
Step 3: Anchor landmarks
• Snap each landmark to nearest node
• Junction vs endpoint preference
• Store snap_distance
Step 4: Compute wing axis
• Proximal / distal from landmarks
• Unit vector + length
Step 5: Call veins
• Merge through crossvein junctions
• Detect costa (margin band)
• Propagate labels through deg-2
• Extend to distal landmarks
• Detect L6
• Detect crossveins (ACV / PCV)
• Label ectopic veins (EV*)
• Assign tissue polys (buffer vw)
• h-maxima split of intervein polys
Step 6: Call intervein regions
• Buffer vein centerlines
• Match bounding-vein sets
• Tie-break by wing-axis position
• Absorb tiny fragments
measurementMaker: custom distances
• User-defined landmark-pair distances
• Augments batch CSV with custom_<label>_um columns
• Fast path: emits CSV without running identifyFeatures
WingResult
• veins: list[VeinIdentification]
• intervein_regions: list[InterveinRegion]
• landmarks, wing_outline, warnings
• Inverse-rescale (Stage 1) back to original-pixel space
per-wing GeoJSON
• {stem}_output.geojson
vein + intervein overlay
• {stem}_overlay.png
landmarks output
• {stem}_landmarks_overlay.png (rendered points)
• {stem}_landmarks.geojson (raw points, optional)
segmentation output
• {stem}_segmentation_overlay.png (vein/intervein classes)
• {stem}_segmentation.geojson (raw polygons, optional)
isolated wing image
• {stem}_isolated.tif
• Masked single-wing image (Stage 2 artifact kept as output)
chopped image
• {stem}_chopped.tif
• Hinge-removed image (Stage 4 artifact kept as output)
AP compartment overlay
• {stem}_ap_overlay.png
CV ratio overlay
• {stem}_cv_ratio_overlay.png
measurements csv
• area (wing, intervein regions, A/P compartments)
• length (wing, veins)
• custom measurements (from measurementMaker)