Open
Description
The widget._get_features()
function is pretty elementary in the cross-layer functionality of the current plugin:
def _get_features(self):
features = pd.DataFrame()
for layer in self.layers:
_features = layer.features[self.common_columns].copy()
# Add layer name as a categorical column
_features["layer"] = layer.name
_features["layer"] = _features["layer"].astype("category")
features = pd.concat([features, _features], axis=0)
# make sure that MANUAL_CLUSTER_ID is always categorical
if "MANUAL_CLUSTER_ID" in features.columns:
features["MANUAL_CLUSTER_ID"] = features[
"MANUAL_CLUSTER_ID"
].astype("category")
return features.reset_index(drop=True)
Here, a layer's name is used to correctly assign every feature to the respective layer it orginates from. However, napari now provides the layer.unique_id
which I believe is a more reliable identifier to tell layers apart. With a little extra work, we could add the layer as an additional categorical column to color objects by. This would be super helpful to check whether clusters correspond to batch effects interactively.