@@ -65,18 +65,15 @@ def keyPressEvent(self, e): # hit space to remove point
65
65
self .coords = self .coords [:- 1 ]
66
66
67
67
def sortCentroid (self , centroid ):
68
+ scent = sorted (centroid , key = lambda x : x [0 ])
68
69
sortList = []
69
70
a = 0
70
71
comLength = 0
71
72
for length in self .rowcount :
72
73
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 ]])))
74
75
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
80
77
81
78
def overlay_cores (self , core_diameter , scale_index , cores , autopilot = False ): # removed - centroid, image, cores
82
79
if len (self .rectsandtext ) >= 1 :
@@ -93,7 +90,6 @@ def overlay_cores(self, core_diameter, scale_index, cores, autopilot=False): #
93
90
else :
94
91
self .centroid = [(y , x ) for (x , y ) in self .coords ]
95
92
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" )
97
93
diameter = core_diameter / scale_index
98
94
a = 0
99
95
for y , x in self .centroid :
@@ -382,10 +378,12 @@ def read_excel(self):
382
378
cores = []
383
379
for col in ws .iter_cols ():
384
380
for cell in col :
385
- values .append (cell .value )
386
381
if cell .value == 1 :
387
382
cores .append (cell .coordinate ) # get core names if contain a 1
388
383
cores .sort (key = lambda x : x [1 :])
384
+ for row in ws .iter_rows ():
385
+ for cell in row :
386
+ values .append (cell .value )
389
387
values = np .array_split (values , ws .max_row )
390
388
for row in values :
391
389
rowcount .append (np .count_nonzero (row )) # EXCEL END
@@ -395,7 +393,6 @@ def read_excel(self):
395
393
self .rowcount = rowcount
396
394
self .arrayshape = (ws .max_row , ws .max_column )
397
395
self .scene .rowcount = rowcount
398
-
399
396
# check for pathology file
400
397
if len (wb .sheetnames ) > 1 :
401
398
ws = wb .worksheets [1 ] # pathology tab (hopefully)
0 commit comments