-
Notifications
You must be signed in to change notification settings - Fork 10
Description
β¨ Rationalization of BaseProcessor method names for core processing types
π Motivation
The BaseProcessor class in DataLab provides a set of generic methods that implement core data processing patterns (e.g., one input β one output, multiple inputs β single output, etc.). These methods were historically named using a numerical convention such as compute_11, compute_10, compute_n1, and compute_n1n.
While functional, this legacy naming:
- lacks semantic clarity (
compute_n1nis particularly ambiguous), - does not clearly reflect input/output arity or selection behavior,
- is not alphabetically cohesive beyond the shared
compute_prefix, - and limits future extensibility (e.g. for ternary or generative processing types).
This issue proposes a new clear and extensible naming convention, directly based on input/output signatures and selection multiplicity semantics.
β Proposed naming convention
Each generic method is now named using the pattern compute_X_to_Y, where:
Xis the number of inputs (which may include binary pairings),Yis the number of outputs.
This convention supports both multi-selection (e.g. applying an operation to k objects) and pairwise processing (e.g. applying a binary operation between two matched lists of objects).
Processing types
| Method name | Signature | Multi-selection support | Description |
|---|---|---|---|
compute_1_to_1 |
1 β 1 | k β k | Single-object transformation (e.g. normalization, FFT, filtering) |
compute_1_to_0 |
1 β 0 | k β no output | Analysis or measurement (e.g. statistics, peak detection) without new object |
compute_1_to_n |
1 β n | k β kΒ·n | One input produces multiple outputs (e.g. ROI extraction) |
compute_n_to_1 |
n β 1 | n β 1 n β n (pairwise mode) |
Aggregation of multiple objects (e.g. sum, mean), supports pairwise variant |
compute_2_to_1 |
1 + 1 β 1 | k + 1 β k n + n β n (pairwise mode) |
Binary operation between an object and an operand; supports pairwise |
π Mapping with previous method names
| Legacy name | New name | Notes |
|---|---|---|
compute_11 |
compute_1_to_1 |
One-to-one transformations |
compute_10 |
compute_1_to_0 |
Measurement/analysis with no object output |
compute_1n |
compute_1_to_n |
Multi-object generation from single input |
compute_n1 |
compute_n_to_1 |
Aggregation across objects |
compute_n1n |
compute_2_to_1 |
Now unified; supports both single and pairwise modes |
β οΈ Breaking change
These methods are internal or only intended for advanced developers (e.g. plugin authors or macro-command developers).
Backward compatibility will not be maintained, as the renaming has no impact on public or user-facing APIs.
All internal usage (including within SignalProcessor, ImageProcessor, plugins, and macros) will be updated accordingly.
π Next steps
- Rename all generic methods in
BaseProcessor - Update all subclasses (
SignalProcessor,ImageProcessor, etc.) - Refactor plugins and macro-commands using these methods
- Document the new processing types in the developer documentation
π Benefits
- π§ Clarity: method names clearly reflect input/output behavior.
- π Simplicity: removes unnecessary terminology (
map,reduce, etc.). - π§© Extensibility: supports future types like
compute_0_to_1,compute_n_to_n, etc. - π Consistency: all generic methods begin with
compute_, aiding sorting and readability. - π§ Better tooling: enables automation for menus, visual pipelines, and API generation.
Feedback and suggestions are welcome before finalizing the migration.