glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
721 stars 152 forks source link

X and Y problems with ScatterRegions #2464

Closed jfoster17 closed 7 months ago

jfoster17 commented 7 months ago

Describe the bug There are two related problems with the current implementation of ScatterRegions on the image viewer. In the following, the RegionData region_data has regions describe by (x', y') coordinate pairs and thus centroid attributes x' and y' while the image_data has x and y pixel coordinates (and optionally wx and wy world coordinates).

  1. If the user links x' <-> x and y' <-> y, everything is good. If the user links x' <-> y and y' <-> x (perhaps because the coordinates in region_data come from a data source with ambiguous names (spatial_0 and spatial_1 are common in biology) then the regions will still display correctly on the image, because we only check if the viewer x_att and y_att are in the list of special region centroid coordinates [x',y'] and we only display the regions naively assuming that x_att is the same as x', but subsets defined on the image will select the wrong points on region_data.
  2. If the user switches the x_att and y_att in the ImageViewer options so that x_att = y and y_att = x, the regions will not display correctly.

Probably the same improved logic for checking viewer attributes will work for both these cases, but case 2 will require a transformation of the region geometries (as we currently do for images with world coordinates).