vitessce / vitessce-python

Python API and Jupyter widget for Vitessce
https://python-docs.vitessce.io
MIT License
40 stars 7 forks source link

Question: How to show the obsSets on hover in spatial viewer of ome-tiff Image #389

Open vdsukhov opened 1 week ago

vdsukhov commented 1 week ago

Hi everyone,

First, thank you for this fantastic package — I'm really enjoying using it!

I have a quick question regarding customizing the information displayed when hovering over the mask of segmented cells. Currently, I only see the Cell ID on hover. I have added an object to my dataset containing additional information under obsSets, and I can see the cells are correctly colored by their classification. However, I can't seem to find a way to display this extra information (such as the classification label) when hovering over the cells.

Could anyone guide me on how to add or configure additional hover information for the segmented cells?

I've attached a couple of screenshots to illustrate the current behavior.

Thanks in advance for your help!

Here is the code snippet that I used to run the widget:

from vitessce import ( 
    VitessceConfig,
    Component as cm,
    CoordinationType as ct,
    OmeTiffWrapper,
    MultiImageWrapper, CsvWrapper
)
from os.path import join

vc = VitessceConfig(schema_version="1.0.16", name='CODEX', description='decr')
dataset = vc.add_dataset(name='CODEX').add_object(
    MultiImageWrapper(
        image_wrappers=[
            OmeTiffWrapper(
                img_url='http://localhost:8001/JK_SPL008_Scan1.ome.tif', 
                name="image"
            ),
            OmeTiffWrapper(
                img_url='http://localhost:8001/JK_SPL008_Scan1_segmentation.ome.tiff', 
                name="mask", is_bitmask=True),
        ],
 ),
).add_object(
    CsvWrapper(
        csv_url="http://localhost:8001/JK_SPL008.csv",
        data_type="obsSets",
        coordination_values={"obsType": "cell"},
        options={"obsIndex": "cell_id", "obsSets": [{"name": "classification", "column": "cluster"}]}
    )
)

spatial = vc.add_view(cm.SPATIAL, dataset=dataset)
lc = vc.add_view(cm.LAYER_CONTROLLER, dataset=dataset).set_props(disableChannelsIfRgbDetected=False)
obs = vc.add_view(cm.OBS_SETS, dataset=dataset)
vc.layout(spatial | lc / obs)

image