Skip to content

Applying colormap to a Slicer object #54

Description

@SM-93

Hi,
I am trying to apply a colormap to already segmented images, i.e. I want to be able to color the labels when I change the slice index but I dont know how to incorporate input argument "value" in my function or do I even need that since I based my code on the example threshold_overlay.py but I don't need the contrast limit.
This is the code snippet:

@app.callback(
    [
        Output(slicer1.overlay_data.id, "data")
    ],
    [Input("main-slider", "value")]
)
def apply_colors(value):
    print(value)
    mask = mask.astype(np.uint8)

    return slicer1.create_overlay_data(mask, colormap_gt)

I have three Slicer objects and I want on the two of those three to color the labels.
The thing is my mask is already defined, i.e. my segmented images with 8 possible values (from 1 through 8).

I would really appreciate if someone could help me with this.

When I run the app in the browser, it displays the error:

dash.exceptions.InvalidCallbackReturnValue: Invalid number of output values for ..slicer2-overlay.data...
Expected 1, got 139

But my mask is already the same shape as the volume.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions