napari-spatialdata icon indicating copy to clipboard operation
napari-spatialdata copied to clipboard

Clean up legacy code in `_models.py` and related parts

Open LucaMarconato opened this issue 2 years ago • 4 comments

CC @giovp, please comment on this.

_models.py contains a lot of legacy code that makes the code fragile. In particular we should remove the following:

  • [x] _scale, not used anymore now that we have coordinate transformations
  • [x] _spot_diameter/_point_diameter, we should keep one of the two only
  • [x] label_key (and relative methods, like the getter/setter labels_key. This is in reality instance_key, and for some reasons it's used only for labels. The region_key + instance_key logic applies both to labels and shapes (shapes=circles or polygons/multipolygons). I suggest either to add region_key and instance_key to the model, or not put them in the model at all. I favor the second approach.
  • [x] remove _spatial_key, not needed any more

In this PR I would also make the following change:

  • [x] since we don't need both _spot_diameter and _point_diameter, let's remove the points widget from the bottom right UI; it's never used.

LucaMarconato avatar Nov 05 '23 21:11 LucaMarconato

yes! yes agree on all the points

giovp avatar Nov 06 '23 08:11 giovp

I can pick this up

melonora avatar Nov 06 '23 11:11 melonora

More on this:

  • spot_diameter seems to never be used.

LucaMarconato avatar Mar 08 '24 12:03 LucaMarconato

@melonora addressed the point on labels_key here: https://github.com/scverse/napari-spatialdata/pull/200/files. Great work!

LucaMarconato avatar Mar 08 '24 12:03 LucaMarconato