Skip to content

Commit

Permalink
phoenix 2/2
Browse files Browse the repository at this point in the history
  • Loading branch information
cudmore committed Feb 2, 2025
1 parent 40cc704 commit 3f16dcb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/pymapmanager/annotations/baseAnnotationsCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def getSegmentPlot(self,
return df

def getRow(self, rowIdx : int):
"""Get columns and values for one row index.
"""Get columns and values for one row label index.
"""
df = self.getDataFrame()
row = df.loc[rowIdx]
Expand Down Expand Up @@ -463,15 +463,15 @@ def editSpine(self, editSpineProperty : List[dict]):

def spineID_Exists(self, spineID : int) -> bool:
if not isinstance(spineID, int):
logger.error(f'got bad spineID:{spineID}, expecting int')
logger.error(f'got bad spineID:{spineID} {type(spineID)}, expecting int')
return False
if spineID not in self.singleTimepoint.points.index:
logger.error(f'spineID:{spineID} does not exists')
# print(self.singleTimepoint.points.index)
return False

logger.info(f'spineID:{spineID}')
print(self.singleTimepoint.points.index)
# logger.info(f'spineID:{spineID}')
# print(self.singleTimepoint.points.index)
return True

def moveSpine(self, spineID :int, x, y, z):
Expand Down
2 changes: 2 additions & 0 deletions src/pymapmanager/interface2/runInterfaceBob.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def run():
# path = '/Users/cudmore/Desktop/multi_timepoint_map_seg_spine_connected.mmap'
# path = mapmanagercore.data.getMultiTimepointMap()

path = '/Users/cudmore/Desktop/olsen_example.mmap'

app = PyMapManagerApp(sys.argv)
# mw will be map widget if path has multiple timepoints, otherwise mw is a stackwidget2
mw = app.loadStackWidget(path)
Expand Down
30 changes: 23 additions & 7 deletions src/pymapmanager/interface2/stackWidgets/spineInfoWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ def __init__(self, stackWidget : stackWidget2):

# The columns values that are displayed
# self.infoList = ["index", "segmentID", "note", 'accept', 'userType', 'spineLength']
self._displayList = ["index", "segmentID", 'spineLength', 'roiType']
self._displayList = ["index",
"segmentID",
'spineLength',
'spineAngle',
'spineSide',
'roiType']
# this list can be edited by user
self.infoList = self._displayList + ["note", 'accept', 'userType']

# Maintain different widgets that display information
Expand Down Expand Up @@ -84,9 +90,9 @@ def _selectionInfoUI(self):
vLayout.addWidget(aLabel, row, col, rowSpan, colSpan)
col += 1

# if itemName == 'index':
# if itemName in ['index', 'roiType', 'segmentID', 'spineLength']:
# aWidget = QtWidgets.QLabel()
if itemName in ['index', 'roiType', 'segmentID', 'spineLength']:
if itemName in self._displayList:
aWidget = QtWidgets.QLabel()
elif itemName == 'note':
aWidget = QtWidgets.QLineEdit('')
Expand Down Expand Up @@ -192,13 +198,15 @@ def _updateUI(self, rowIdx : List[int]):
self._enableAllWidgets(True)

# just the first row selection
rowIdx = rowIdx[0]
firstRowIndex = rowIdx[0]
self._pointRowSelection = firstRowIndex

self._pointRowSelection = rowIdx
logger.info(f'firstRowIndex:{firstRowIndex}')

# keys are all possible columns, we only show columns in infoList
# values are, well, the values
rowDict = self.pa.getRow(rowIdx)
rowDict = self.pa.getRow(firstRowIndex)
logger.info(f'rowDict:{rowDict}')

for index, itemName in enumerate(self.infoList):
if itemName not in self.widgetDict.keys():
Expand All @@ -208,6 +216,7 @@ def _updateUI(self, rowIdx : List[int]):

if itemName not in rowDict.keys():
# our itemName we want to display is not in the backend
logger.warning(f'item name "{itemName}" is not in backend keys')
continue

backendValue = rowDict[itemName]
Expand All @@ -217,9 +226,16 @@ def _updateUI(self, rowIdx : List[int]):
# self.blockSignals(True)
self.blockSlotsOn()

# abb do not hard code items, use the self._displayList
# ["index", "segmentID", "note", 'accept', 'userType']
if itemName in ['index', 'segmentID', 'note', 'spineLength']:
# if itemName in ['index', 'segmentID', 'note', 'spineLength']:
# itemWidget.setText(str(backendValue))
if itemName in self._displayList:
# labels
itemWidget.setText(str(backendValue))
elif itemName == 'note':
logger.warning(f'setting note {firstRowIndex} to "{backendValue}"')
itemWidget.setText(backendValue) # QLineEdit
elif itemName == 'accept':
# logger.info(f'backendValue: {backendValue} {type(backendValue)}')
itemWidget.setChecked(bool(backendValue))
Expand Down
14 changes: 1 addition & 13 deletions src/pymapmanager/timeseriesCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(self, path : str):
# if path.endswith('.mmap') or path.endswith('.mmap/') or path.endswith('.mmap.zip'):
if _ext in LOAD_SAVE_EXTENSIONS:
self._load_zarr()
elif path.endswith('.tif'):
elif path.endswith('.tif') or path.endswith('.nd2'):
self._import_tiff()
# elif path.endswith('.ome.zarr'):
# elif path.endswith('.zarr') or path.endswith('.zarr/'):
Expand Down Expand Up @@ -331,22 +331,10 @@ def _import_tiff(self):
loader = MultiImageLoader()
loader.read(path, channel=0)

# TEMPORARY, fake second channel, to debug single channel stack
# loader.read(path, channel=1)

# map = MapAnnotations(loader.build(),
map = MapAnnotations(loader,
lineSegments=pd.DataFrame(),
points=pd.DataFrame())

# abb trying to figure out tree
from pprint import pprint
logger.info('dataTree???')
pprint(loader.dataTree())

# map.points[:]
# map.segments[:]

self._fullMap : MapAnnotations = map

def _import_ome_zarr(self):
Expand Down

0 comments on commit 3f16dcb

Please sign in to comment.