Skip to content

Discussion: unique names for elements, pro and cons #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LucaMarconato opened this issue Feb 2, 2023 · 3 comments
Closed

Discussion: unique names for elements, pro and cons #124

LucaMarconato opened this issue Feb 2, 2023 · 3 comments

Comments

@LucaMarconato
Copy link
Member

I propose to enforce unique names among the elements of one SpatailData object. Here I explore the implications.

Cons:

  • The user has less freedom since different types can't have the same name. Still, when merging/concatenating different SpatialData objects (say 1 sdata = 1 sample), one could have exactly the same name for the same element types (like all the Labels are called cells), so the user is already limited in this regard.

Neutral:

  • The file storage can be kept as it is (because we can infer types when we read), or we can choose to make it completely flat.

Pro:

  • In transformations, see discussion in the comment below this one, we can have function calls like this
points = sd.transform(sdata, element_name='cells', tgt="tgt_space")

instead of this

points = sd.transform(sdata, element_type='labels', element_name='cells', tgt="tgt_space")
  • (big pro): the tables, the column "instance_key" can be a simple string like "cell_segmentation", now it needs to be "/labels/cell_segmentation" and this feels super weird.
@LucaMarconato
Copy link
Member Author

LucaMarconato commented Feb 10, 2023

If we go for unique names we could implement the set_transfomation() and remove_transformation() functions with a signature like sdata.set_transformation(self, Union[str, SpatialElement], ...etc), where the string is the name of the element.

EDIT: these functions have different signature now.

@LucaMarconato
Copy link
Member Author

Another argument in favor for unique names is that napari layers must have unique names.

@LucaMarconato
Copy link
Member Author

Unique names have been implemented. The function sd.transform hasn't been modified, but if implementing this signature or not:

points = sd.transform(sdata, element_name='cells', tgt="tgt_space")

should be done eventually in another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant