Repository navigation
L5: per-backend processors written once against arraybridge ArrayOperations - #1191
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ArrayOperations image_stack_operations holds every operation that two or more backends implemented identically modulo the array library: stack validation, linear weight masks, mask application, max/mean/min projection with one StackProjection family, spatial binning with one SpatialBin family, crop, histogram equalization and percentile normalization (NumPy/CuPy), composite weight validation and the weighted composite. Each backend module registers them with its ArrayOperations.for_memory leaf, keeping registered identities, signatures and contracts; it keeps its own body only where the algorithm genuinely differs (sharpen, tophat, torch/JAX/TensorFlow/pyclesperanto normalization and equalization, numba/torch/TensorFlow/pyclesperanto composites, pyclesperanto mask, linear mask and float32 mean). Deleted: percentile_utils.py, six StackProjection and two SpatialBin strategy families, six _validate_3d_array copies, the OPENHCS_SUBPROCESS_NO_GPU branches, _check_pyclesperanto_available, the TensorFlow version probe, PyclesperantoMaskDimensionality, the unregistered numpy min_projection, and the hand-written torch/TensorFlow integer dtype maxima. StackProjectionMethod gains MIN. arraybridge pinned >=0.4.0,<0.5; submodule at the PR branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge-operations # Conflicts: # pyproject.toml
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surface L5 (replaces C4). Receipt with the census and parity table:
docs/refactor/consolidation-20261009/L5-arraybridge-operations.md.Library PR: OpenHCSDev/ArrayBridge#10 (0.4.0, CI 14/14 green, not merged or tagged). The submodule points at its branch head
6f6f907; the pin isarraybridge>=0.4.0,<0.5. Merge this after the library is released.What changed
ArrayOperationsis a registered family (one leaf per memory type);ArrayOperations.for_memory(MemoryType.X)returns the leaf. Leaves hold only the primitives that differ (max/min/mean/sum,astype,prepend_axis,linspace,ones,assign,outer,floor,accepts). The string*_OPERATIONSroster is deleted. The TensorFlow leaf now names dtypes through its NumPy dtype, which fixes "Cannot interpret 'tf.uint16'" on every decorated TensorFlow call.processors/image_stack_operations.pywrites the shared operations once: validation, linear/weight masks, apply_mask, max/mean/min projection + oneStackProjectionfamily, spatial binning + oneSpatialBinfamily, crop, equalization and percentile normalization (NumPy/CuPy), composite weights and the weighted composite.<backend>_processor.pykeeps its registered names, signatures and contracts. Each name delegates to the shared operation, except where the algorithm genuinely differs (census ≠ cells: sharpen, tophat, and per-backend normalization, equalization and composites).StackProjectionMethodgains MIN.NumpyStackProjectionMethodis kept because saved pipelines import it (decision default).Deletions and certificates
image_stack_operations+ArrayOperations.for_memory; covered by per-backend parity): per-backend copies ofcreate_linear_weight_mask(numpy, cupy, jax, torch, tf),create_weight_mask(all 6),apply_mask(5),max_projection(6),mean_projection(5),create_projection+ 6 StackProjection strategy families, 2 SpatialBin families +spatial_bin_2d/3dandcrop(numpy, cupy), equalization (numpy, cupy),percentile_utils.py, composite weight validation (numpy, cupy, jax, cle), the weighted composite (cupy, jax), 6_validate_3d_array, andPyclesperantoMaskDimensionality. arraybridge's*_OPERATIONSsingletons and name field: derived from the registry.torch.iinfoand TensorFlowDType.max): the hand-written integer-maximum tables in torchcreate_compositeandstack_equalize_histogram, and in TensorFlowstack_equalize_histogram.create_compositelogging; numpymin_projection(an unregistered public helper with no reader in the repo;create_projection(MIN)serves it).create_compositeinteger clamp: it takes a list of stacks, and parity passed stacks, so it raised TypeError both before and after.OPENHCS_SUBPROCESS_NO_GPUbranches (the registry already skips modules of disallowed memory types)._check_pyclesperanto_available.Verification
create_projectionandcreate_weight_maskfailed on main through the broken nested decorator). Decorated TensorFlow now equals undecorated. See the receipt table.test_maindisk + direct: 3/3 viewer-less cases pass. The 9 napari/fiji cases fail with "no Qt platform plugin" and fail identically on b987b7b.L5 · PRs OpenHCSDev/ArrayBridge#10 + this · guards 4/4 · production −1913 +692 · tests −199 +184🤖 Generated with Claude Code