Skip to content

Commit 697c9b1

Browse files
committed
correct rowcount
1 parent 0a2da13 commit 697c9b1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

scripts/Cut_Application_thread.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,15 @@ def keyPressEvent(self, e): # hit space to remove point
6565
self.coords = self.coords[:-1]
6666

6767
def sortCentroid(self, centroid):
68+
scent = sorted(centroid, key=lambda x: x[0])
6869
sortList = []
6970
a = 0
7071
comLength = 0
7172
for length in self.rowcount:
7273
comLength = comLength + length
73-
sortList.append((sorted(centroid[a:comLength], key=lambda k: [k[1]])))
74+
sortList.extend((sorted(scent[a:comLength], key=lambda k: [k[1]])))
7475
a = a + length
75-
sortedCentroid = []
76-
for x in sortList:
77-
for y in x:
78-
sortedCentroid.append(y)
79-
return sortedCentroid
76+
return sortList
8077

8178
def overlay_cores(self, core_diameter, scale_index, cores, autopilot=False): # removed - centroid, image, cores
8279
if len(self.rectsandtext) >= 1:
@@ -93,7 +90,6 @@ def overlay_cores(self, core_diameter, scale_index, cores, autopilot=False): #
9390
else:
9491
self.centroid = [(y, x) for (x, y) in self.coords]
9592
self.centroid = [(self.centroid[i][0]+self.circles[i].scenePos().y(), self.centroid[i][1]+self.circles[i].scenePos().x()) for i in range(len(self.circles))]
96-
print(self.centroid, "centroid")
9793
diameter = core_diameter / scale_index
9894
a = 0
9995
for y, x in self.centroid:
@@ -382,10 +378,12 @@ def read_excel(self):
382378
cores = []
383379
for col in ws.iter_cols():
384380
for cell in col:
385-
values.append(cell.value)
386381
if cell.value == 1:
387382
cores.append(cell.coordinate) # get core names if contain a 1
388383
cores.sort(key=lambda x: x[1:])
384+
for row in ws.iter_rows():
385+
for cell in row:
386+
values.append(cell.value)
389387
values = np.array_split(values, ws.max_row)
390388
for row in values:
391389
rowcount.append(np.count_nonzero(row)) # EXCEL END
@@ -395,7 +393,6 @@ def read_excel(self):
395393
self.rowcount = rowcount
396394
self.arrayshape = (ws.max_row, ws.max_column)
397395
self.scene.rowcount = rowcount
398-
399396
# check for pathology file
400397
if len(wb.sheetnames) > 1:
401398
ws = wb.worksheets[1] # pathology tab (hopefully)

0 commit comments

Comments
 (0)