mobie / mobie-utils-python

Python tools for MoBIE
MIT License
9 stars 5 forks source link

display transformed Segmentations #106

Open martinschorb opened 1 year ago

martinschorb commented 1 year ago

Hi, probably also a spec issue, but I run into this inconsistency when using MoBIE-Python.

The table data of the two displayed segmentations should stay the same as for the original segmentation source. Now, I run into the problem, that the "new" segmentationDisplays do no longer point to the original table, so the view is not displayed and also validation fails (as expected) with :

ValueError: The table source MSB30_4_derivedsourceblabla is not present in the source metadata.

I thought of just pointing it to the original table but then I am back to:

  File "..../mobie-utils-python/mobie/metadata/view_metadata.py", line 347, in get_view
    assert display_setting["segmentationDisplay"]["name"] == name,\
AssertionError: MSB30_4_spotIDs, MSB30_4_spotIDs_tp_44-to-48

that the names no longer match.

Now, the only solution/workaround I see at the moment is duplicating the tables and creating a new directory for each segmentationDisplay. This can easily become a pain with dozens if not hundreds of duplicate directories.

Also, if something changes in the original table, ideally all derived tables or segmentationDisplays should update accordingly.

So I think we need a thorough re-think of how to deal with these "transient" or "virtual" sources created within a view with sourceNamesAfterTransform.

Or we need to allow linking to another default table for a segmentationDisplay ( and modify these checks in get_view).

Any ideas and thoughts?

constantinpape commented 1 year ago

Hi Martin, I think I understand the issue and indeed that might be a corner case that is not supported in the python code (and maybe also not in the spec) yet. I will try to have a closer look at this later, but as this is quite complex it would help a lot to have a minimal reproducible example.

martinschorb commented 1 year ago

The following procedure generates a view that cannot be reproduced in mobie:

This view "twoseg_fromMoBIE" shows both segmentations at the same position, because the transform has no sourceNamesAfterTransform.

When I manually add the sourceNamesAfterTransform ("twoseg_sourcenames"), I run into the table issue.

The project can be found in /g/emcf/schorb/data/sourcenames

martinschorb commented 1 year ago