You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the table misses some instances or contains NaN values, colors are not mapped. Specifically if:
The table contains less instances than the segmentation image in labels
Or an observation column or X column contains NaN (because missing values have been filled up).
Actual behavior:
If an obs/X column contains NaN and the non-NaN values are all the same, all labels are visualized with color, as if it ignores the fact that some are NaN.
Expected behavior:
It does not color values that are NaN.
The text was updated successfully, but these errors were encountered:
aeisenbarth
changed the title
No color mapped when annotations incomplete
NaN values colored if non-NaN values are only one
Apr 29, 2024
Sorry, the initial observation actually is working correctly.
Except in one edge case:
If a column's non-NaN values have a single value (all same or NaN), all labels receive the same color (yellow) although the NaN labels should be transparent.
This is specifically the case when n_obs == 2 (so rather a rare case, not a critical issue):
importanndataasadimportnumpyasnpimportpandasaspdimportspatialdataassdfromnapari_spatialdataimportInteractivelabels=sd.models.Labels2DModel.parse(np.array([[0, 1], [2, 0]]), dims=("y", "x"))
adata=ad.AnnData(obs=pd.DataFrame({"col1": [0.5, np.nan], "region": "region1", "instance_id": [1, 2]}))
table=sd.models.TableModel.parse(adata, region=["region1"], region_key="region", instance_key="instance_id")
sdata=sd.SpatialData(labels={"region1": labels}, table=table)
Interactive(sdata=sdata)
# Expected: obs "col1" is yellow for label 1 (top right) and transparent for label 2 (bottom left)# Actual: label 1 and label 2 are yellow
When the table misses some instances or contains NaN values, colors are not mapped. Specifically if:The table contains lessinstances
than the segmentation image inlabels
Or an observation column or X column contains NaN (because missing values have been filled up).Actual behavior:
If an obs/X column contains NaN and the non-NaN values are all the same, all labels are visualized with color, as if it ignores the fact that some are NaN.
Expected behavior:
It does not color values that are NaN.
The text was updated successfully, but these errors were encountered: