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
importenumimportpandasaspdclasslayerTypes(enum.Enum):
# image = 'image'points='points'lines='lines'roi='roi'classaddToLayerAPI():
defgetPointAnnotations(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. """passdefgetLineAnnotations(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. """defgetROIs(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# defaddPoint(self, x : int, y : int, z : int, roiType):
"""Add a point annotation. """defaddSpine(self, x : int, y : int, z : int, segmentID : int):
"""Add a spine point annotation. """defdeletePoint(self, layerType : layerTypes, idx : int):
"""Delete a point/line annotation. """defsetValue(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 functions
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