Skip to content

Commit

Permalink
Bug fix: error for z plus or minus when df is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jtle00 committed Jul 18, 2024
1 parent 51e357c commit aee83b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
32 changes: 16 additions & 16 deletions pymapmanager/annotations/baseAnnotationsCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ def getSegmentPlot(self, segmentID,
_stopSlice = zSlice + zPlusMinus

df = self.getDataFrame()
# logger.info(f"df: {df}")
df['rowIndex'] = list(np.arange(len(df)))
df = df[(df['z']>=_startSlice) & (df['z']<=_stopSlice)]

#abj: 7/17/24
if not df.empty:
df = df[(df['z']>=_startSlice) & (df['z']<=_stopSlice)]

return df

Expand Down Expand Up @@ -264,15 +268,15 @@ def _buildDataFrame(self):
"""

# _startSec = time.time()

# logger.info(f"self._fullMap.points {self._fullMap.points}")
# logger.info(f"type self._fullMap.points {type(self._fullMap.points)}")
try:
allSpinesDf = self._fullMap.points[:]
except (KeyError) as e:
logger.warning(e)
return

# abj:
# check if points are empty:
#abj: check if points are empty:
if len(allSpinesDf) > 0:
logger.info(f"allSpinesDf {type(allSpinesDf)}") # <class 'geopandas.geodataframe.GeoDataFrame'>
# logger.info(f"allSpinesDf['point'] {type(allSpinesDf['point'])}")
Expand Down Expand Up @@ -305,6 +309,11 @@ def getSpineLines(self):
1 382.0 250.0 NaN
"""
# anchorDf = self._sessionMap['anchors'].get_coordinates(include_z=True)

# test= self._fullMap.points['anchorLine']
# logger.info(f"getSpineLines test {test}")
# logger.info(f"getSpineLines test type {type(test)}")

anchorDf = self._fullMap.points['anchorLine'].get_coordinates(include_z=True)
return anchorDf

Expand Down Expand Up @@ -407,20 +416,11 @@ def _buildDataFrame(self):
# print('_lineSegments:', _lineSegments)

# mapmanagercore.annotations.single_time_point.layers.AnnotationsLayers
logger.info(f'self._fullMap type:{type(self._fullMap)}')
logger.info(f'self._fullMap:{self._fullMap}')
# logger.info(f'self._fullMap type:{type(self._fullMap)}')
# logger.info(f'self._fullMap:{self._fullMap}')

# logger.info(f'self._fullMap.segments["segment"]:{type(self._fullMap.segments["segment"])}')

# abj try only if df is not empty
segments = self._fullMap.segments
logger.info(f"segments {segments}")
logger.info(f"segments type {type(segments)}")

segmentDF = self._fullMap.segments['segment']
logger.info(f"segmentDF {segmentDF}")
logger.info(f"segmentDF type {type(segmentDF)}")
# if len(segmentDF) > 0:

try:
# self._fullMap.segments[:]
df = self._fullMap.segments['segment'].get_coordinates(include_z=True)
Expand Down
1 change: 1 addition & 0 deletions pymapmanager/interface2/stackWidgets/imagePlotWidget2.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, stackWidget):

self._currentSlice = 0

# TODO: 7/17 - change this to detect amount of channels?
_channel = self._displayOptionsDict['windowState']['defaultChannel']

self._displayThisChannel = _channel # 1->0, 2->1, 3->2, etc
Expand Down

0 comments on commit aee83b8

Please sign in to comment.