-
Notifications
You must be signed in to change notification settings - Fork 1
Linking desktop PyQt with the layers backend #16
Copy link
Copy link
Open
Description
Here are some ideas on the needed functions in the backend layer API so we can get up and running with it in the desktop PyQt app.
For a viewer, all we need is point and line dataframes.
Moving on to editing, we need a few more functions that are probably in the API and we can conform to what is already there.
Let me know what you think @Suhayb-A and @jtle00
import enum
import pandas as pd
class layerTypes(enum.Enum):
# image = 'image'
points = 'points'
lines = 'lines'
roi = 'roi'
class addToLayerAPI():
def getPointAnnotations(self) -> pd.DataFrame:
"""Get the current point annotations as a pandas DataFrame.
Notes
-----
The dataframe should have
- One row per point
- Columns names corresponding to columns in the original csv file.
"""
pass
def getLineAnnotations(self) -> pd.DataFrame:
"""Get the current line annotation as a pandas DataFrame.
Notes
-----
The dataframe should have
- One row per point in the tracing
- Columns names corresponding to columns in the original csv file.
"""
def getROIs(self, spineID : int) -> dict:
"""Get the x and y spine ROIs for the specified spine.
Returns
-------
dict with the following keys:
"xSpineRoi": list of x coordinates in the spine ROI
"ySpineRoi": list of y coordinates in the spine ROI
"xSegmentRoi": ...
"ySegmentRoi": ...
"xBackgroundSpineRoi": ...
"yBackgroundSpineRoiRoi": ...
"xBackgroundSegmentRoi": ...
"yBackgroundSegmentRoi": ...
"""
#
# editing points
# each time we call an edit (mutate) function, the backend point/line dataframe should be updated
#
def addPoint(self, x : int, y : int, z : int, roiType):
"""Add a point annotation.
"""
def addSpine(self, x : int, y : int, z : int, segmentID : int):
"""Add a spine point annotation.
"""
def deletePoint(self, layerType : layerTypes, idx : int):
"""Delete a point/line annotation.
"""
def setValue(self, layerType : layerTypes, pnt : int, col : str, value):
"""Set a property (column name) of an individual line/point annotation.
"""
#
# editing/tracing line segments
#
# COMING SOON, API might need a few more functionsReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels