You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support modifying/filtering labels elements via join operations (#946)
* init
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix mypy linterrors
* update the location and the design
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update docs
* make coverage 100/100 because why not
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed type annotation
* dont compute eagerly use. delete other instance key for consistency
* update the tests and make sure we use match_element_to_table
* wip rewrite tests using existing APIs
* test passing without using subset_sdata_by_table_mask()
* Remove _filter_by_instance_ids and _get_scale_factors; refactor tests to use existing API
- Remove _get_scale_factors (duplicated logic already in transformations/_utils.py)
- Remove _filter_by_instance_ids and subset_sdata_by_table_mask (superseded by match_sdata_to_table / filter_by_table_query)
- Parametrize test_subset_sdata_by_table_mask over both API functions
- Replace test_filter_2d_labels_by_instance_ids with test_filter_out_instances, parametrized over both API functions and element types (2D / multiscale labels)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add filter_label_pixels flag to match_sdata_to_table and filter_by_table_query
Threads a filter_label_pixels: bool = False parameter through the full join
stack (filter_by_table_query → match_sdata_to_table → join_spatialelement_table
→ _call_join → _right/_inner_join_spatialelement_table).
When True, label pixels for removed instances are zeroed via a new
_filter_labels_element helper (handles both DataArray and multiscale DataTree).
When False (default), the existing warning is preserved but now also hints at
the new flag.
Tests no longer need manual _set_instance_ids_in_labels_to_zero calls or
warnings suppression.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Change filter_label_pixels default to None; False silences the warning
- None (default): warn that label pixels are not filtered, hint at the flag
- True: filter label pixels (set removed instance pixels to zero)
- False: skip silently, no warning
Updated docstrings in join_spatialelement_table, match_sdata_to_table,
and filter_by_table_query to document all three states.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move and consolidate label-filtering tests into test_relational_query_match_sdata_to_table
- Replace test_match_sdata_to_table_match_labels_error with
test_filter_out_instances: parametrized over both API functions and
element types; tests all three filter_label_pixels states (None→warn,
False→nullcontext noop, True→pixels filtered)
- Add test_subset_sdata_by_table_mask for mixed-element subsetting
- Delete test_relational_query_subset_sdata_by_table_mask.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Add 3D labels guard to _filter_labels_element; fix annsel list predicate in tests
- Raise NotImplementedError in _filter_labels_element when element is Labels3DModel
- Add test_filter_out_instances_3d_labels_not_supported parametrized over both API functions
- Use an.col().is_in() instead of == [list] in 3D test (narwhals does not support nested literals)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Luca Marconato <m.lucalmer@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments