mlexchange / mlex_highres_segmentation

A Dash interface for ML-based segmentation of user-annotated large multi-dimensional image data
Other
5 stars 4 forks source link

Resetting view flips image on other slices #148

Closed Wiebke closed 1 year ago

Wiebke commented 1 year ago

Using the reset view functionality correctly causes the image to recenter, but has the side-effect that navigating to another slice afterwards will have that image flipped. Recentering again, re-flips the image.

To reproduce: Open the app, click on recenter image, and navigate to another slide.

I have the hunch that the composition of the relayout_data here /callbacks/image_viewer.py#L502 has

relayout_data = {
        "xaxis.range[0]": image_center_coor["x0"],
        "yaxis.range[0]": image_center_coor["y0"],
        "xaxis.range[1]": image_center_coor["x1"],
        "yaxis.range[1]": image_center_coor["y1"],
    }

and should instead be

relayout_data = {
        "xaxis.range[0]": image_center_coor["x0"],
        "yaxis.range[0]": image_center_coor["y1"],
        "xaxis.range[1]": image_center_coor["x1"],
        "yaxis.range[1]": image_center_coor["y0"],
    }

since the larger y-value is set to the first position elsewhere in the code. Testing this switch seems to resolve the problem, but there may be side-effects elsewhere.

@danton267 I think you may have more insight on this?

danton267 commented 1 year ago

Thank you for bringing it up, let me have a look at this!