mapmanager / MapManagerCore

A Python library with the core functionality of MapManager
0 stars 0 forks source link

Can we get a general purpose way to add columns to point and segment/line annotations? These new columns should be saved/loaded and provide a get/set API? #5

Closed cudmore closed 3 months ago

cudmore commented 3 months ago

Feature request

I would like an addition to the core API where I can add arbitrary columns to a point or line annotation (annotations in general).

Once added, I would like API functions to get and set the newly added (and arbitrary) column values for a given row.

I would like these new columns and their row values saved and then loaded with the zarr attributes. Hopefully this is already done? :)

Some examples for additional point annotations columns are ...

Possible implementations

I do not envision this as adding to the member functions of annotations. Instead, something like a general purpose adder, getter, and setter for a given point/segment column name.

1) Add a new column name to annotations? Something like

def addColumn(self, col : str):
    """Add a new column name to underlying pandas dataframe.

    We might want to keep track of the type of the column?
        Is it an int, float, str, bool, categorical, etc?

2) setter

def setPointValue(self, id : str, col : str, value):
    """Set the specified id (row) at column col to a value.
    """

3) getter

def getPointValue(self, id : str, col : str):
    """Get the current value of a specified id (row) column value.

Why is this useful?

We want our front-end web/desktop applications to use this. For example, we want the user to select a point (e.g. spine) and set a textual note. We then want our front end GUIs to display this textual note for a given spine selection. Finally, we want our users to be able to search for a given spine note!!! Super powerfull!