This guide explains the main processing parameters that are currently active in RodSizer.
The current backend uses an AutoDetect-mNP-style workflow in backend/processing.py:
K-means segmentationseparates foreground particles from background.Scale bar maskingremoves the scale bar area so it is not detected as a particle.Solidity-based split logicdecides whether an object is treated as a single particle (solidity > 0.9) or sent to clump splitting.Clump splittingseparates touching/overlapping particles with a marker-controlled watershed on the Euclidean distance transform (autodetect_utils.split_clump). Seeds are extended (h-)maxima of the distance map, so a single elongated rod stays whole while touching rods split at the neck. This replaced the older recursive-erosion (rUECS) path, which was slow and tended to leave dense aggregates fused into one large blob.rUECS/dilmarkersremain in the codebase as reference but are no longer on the hot path.MeasurementusesminAreaRectto estimate rod length and width, then derives shape descriptors per particle.Label overlayassigns each detected particle its own colour (_make_label_overlay) so the per-particle segmentation can be inspected directly.
RodSizer resolves nm/pixel in this order; the first that succeeds wins:
- Manual override (
manual_pixel_size) — or the in-app "draw a line" / numeric calibration. - Linked metadata file — a matching
.dm3/.dm4/.emdsharing the image's base name. - Embedded metadata — Gatan/DM, Velox/EMD, OME-TIFF, FEI/Thermo and ImageJ TIFF tags.
- Burned-in OCR (new) — for camera exports (JPG/PNG/TIF) with no metadata, RodSizer OCRs the bottom metadata footer for
Pixel size … pm/nm(cross-checked againstFov … / image width), and falls back to a drawn scale bar plus its… nmlabel. Requires the Tesseract binary (installed automatically by the launchers); if it is missing, this step is skipped silently. - Uncalibrated placeholder —
1.0 nm/px, flaggedis_placeholder, so measurements stay in a known-provisional state until you calibrate.
| Parameter | Current Value / Behavior | What it does |
|---|---|---|
requested_bar_length_nm |
200.0 nm default |
Draws a synthetic blue scale bar if a real calibration is available and no override is given. |
manual_pixel_size |
Optional user override | Replaces metadata-based calibration when supplied. |
min_area_nm2 |
30 nm^2 |
Rejects very small objects as noise before and after segmentation. |
region.solidity > 0.9 |
Active | Treats highly convex objects as simple particles; lower-solidity objects are treated as clumps and split with the distance-transform watershed. |
binary_mask_tune (separation slider) |
-6 .. +6, default 0 |
Drives both binarisation morphology (closing vs opening) and clump-splitting aggressiveness (watershed seed depth h). Higher = separate more; lower = merge more. |
| Overlap threshold | 0.15 |
Used during non-maximum suppression to skip heavily overlapping duplicate detections. |
| Label overlay | Per-particle colours | Each accepted particle is drawn in its own colour so the segmentation can be verified visually. |
These values are computed for each accepted particle:
length_nmwidth_nmaspect_ratiovolume_nm3orientation_degarea_pxsolidityconvexitycircularityeccentricity
Important: in the current code, aspect_ratio, solidity, and circularity are mainly measurement/classification descriptors. They are not user-facing manual filter knobs in the current workflow.
The following items described in older documentation are not active as manual tuning parameters in the current process_image workflow:
target_dist_nmclosing_radius_nm- manual threshold controls such as
Threshold - older separation/closing sliders or variables
aspect_ratio_pxas a direct hard filtercontainmentas a direct hard filter
- Removes tiny specks, dirt, and segmentation noise.
- Increasing it makes detection more conservative.
- Decreasing it allows smaller objects through, but may increase false positives.
- High-solidity objects are treated as single particles.
- Lower-solidity objects are assumed to be clumps or irregular shapes and are sent to
rUECS. - Increasing this threshold makes the app split more borderline shapes as clumps.
- Decreasing this threshold makes the app keep more irregular shapes as single objects.
- Overrides image metadata calibration.
- Useful when metadata is missing or incorrect.
- A wrong value will directly affect all reported dimensions in nanometers.
- Controls the displayed synthetic scale bar length.
- Default is
200 nm. - This affects the visualization scale bar, not particle detection itself.
If you want to change the current defaults, look in:
The main place to inspect is the process_image(...) function.