fractal-analytics-platform / fractal-tasks-core

Main tasks for the Fractal analytics platform
https://fractal-analytics-platform.github.io/fractal-tasks-core/
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

[DO NOT MERGE] Add `test_workflow_secondary_labeling_two_channels` #642

Closed tcompa closed 5 months ago

tcompa commented 5 months ago

This PR is just to show a failing test that encodes issue #640

tcompa commented 5 months ago

This fails as expected, with this relevant part of the traceback:

        if len(set(shapes)) > 1:
            raise ValueError(
                "Shape mismatch:\n"
                f"{current_label_region.shape=}\n"
                f"{masking_label_region.shape=}\n"
                f"{image_array.shape=}"
            )

        # Compute background mask
        background_3D = masking_label_region != label_value
        if (masking_label_region == label_value).sum() == 0:
            raise ValueError(
                f"Label {label_value} is not present in the extracted ROI"
            )

        # Set image background to zero
        background_4D = np.expand_dims(background_3D, axis=0)
>       image_array[background_4D] = 0
E       IndexError: boolean index did not match indexed array along dimension 0; dimension is 2 but corresponding boolean dimension is 1

fractal_tasks_core/masked_loading.py:174: IndexError