Add or change an operation¶
An operation is more than a numerical function. A complete contribution aligns the headless implementation, registry contract, graph behavior, metadata, interactive inspection, export, examples, and tests.
Design first¶
Specify:
- scientific purpose and evidence for the method;
- input and output semantic types;
- axis and 2D/3D behavior;
- dtype/range behavior and empty/degenerate cases;
- metadata fields preserved, changed, inferred, or dropped;
- execution policy (
autoormanual) and cancellation/progress needs; - expected memory scaling;
- parameters, defaults, bounds, units, and invalid combinations.
Avoid adding a near-duplicate operation only to expand the node count. Prefer a clear focused node when a selector would hide materially different methods or parameter meanings.
Implementation checklist¶
- Add or revise the headless operation under
napari_vipp.core. - Register an
OperationSpecwith a stable ID, title, category, typed ports, parameters, execution policy, and stack-processing note. - Define static or dynamic outputs explicitly; test saved-workflow restoration when the number of ports depends on runtime data.
- Transform
ImageStateorTableStatedeliberately. - Keep Python export and batch execution aligned with interactive semantics, or reject unsupported graphs with a clear error.
- Add focused operation, pipeline, persistence, export, and UI tests in proportion to risk.
- Add a deterministic sample/example only when it teaches or validates a stable capability.
- Update the node reference, workflow guides, validation status, and release notes.
Scientific tests¶
Test invariants with simple truth: uniform images, single objects, known geometries, explicit axes/scale, empty masks, boundary-touching objects, and small arrays. Numerical equality to the same underlying library call is useful but not independent validation of the scientific claim.
For multi-input operations test shape/axis incompatibility and port ordering. For tables test identity columns, units, missing values, and merge behavior—not only that a table object was returned.