@@ -6,8 +6,10 @@ def __init__(self, viewerplus):
66 self .active_label = None
77
88 message = "<p><i>Assign a class to a region</i></p>"
9- message += "<p>Choose the class from the Labels panel</p>"
10- message += "<p>- LMB on a region to assign the class</p>"
9+ message += "<p>Make sure to have chosen a class from the Labels panel</p>"
10+ message += "<p>- SHIFT + LMB on a region to assign the class</p>"
11+ message += ("<p>To assign a class to multiple regions, active the PAN/ZOOM tool, make a<br>"
12+ "selection, and then double-click on a class in the Labels panel.</p>" )
1113 self .tool_message = f'<div style="text-align: left;">{ message } </div>'
1214
1315
@@ -22,39 +24,29 @@ def leftPressed(self, x, y, mods):
2224 return #do nothing, no label is set
2325
2426 # handle points
25-
26- select_point = self .viewerplus .annotations .clickedPoint (x , y )
27- if select_point is not None :
28- self .viewerplus .addToSelectedPointList (select_point )
29- for point in self .viewerplus .selected_annpoints :
30- self .viewerplus .setAnnPointClass (point , self .active_label )
31-
27+ selected_point = self .viewerplus .annotations .clickedPoint (x , y )
28+ if selected_point is not None :
29+ self .viewerplus .setAnnPointClass (selected_point , self .active_label )
3230 return
3331
3432 # handle areas
35-
3633 selected_blob = self .viewerplus .annotations .clickedBlob (x , y )
37- if selected_blob is None :
38- return
39-
40- self .viewerplus .addToSelectedList (selected_blob )
41-
42- genets = set ()
43- for blob in self .viewerplus .selected_blobs :
44- if blob .genet is not None \
45- and blob .genet >= 0 :
46- genets .add (blob .genet )
47- else :
48- self .viewerplus .setBlobClass (blob , self .active_label )
49-
50- project = self .viewerplus .project
51- for image in project .images :
52- blobs = [blob for blob in image .annotations .seg_blobs if blob .genet in genets ]
53- for blob in blobs :
54- self .viewerplus .setBlobClass (blob , self .active_label )
55-
56- # if image == self.viewerplus2.image //we need to update also the other viewer!!!!
57- # 2) l'undo ha lo stesso problema, posso aggiungere i blob ma devono essere fatti per ogni immagine.
34+ if selected_blob is not None :
35+ self .viewerplus .setBlobClass (selected_blob , self .active_label )
36+
37+ # genets = set()
38+ # for blob in self.viewerplus.selected_blobs:
39+ # if blob.genet is not None \
40+ # and blob.genet >= 0:
41+ # genets.add(blob.genet)
42+ # else:
43+ # self.viewerplus.setBlobClass(blob, self.active_label)
44+ #
45+ # project = self.viewerplus.project
46+ # for image in project.images:
47+ # blobs = [blob for blob in image.annotations.seg_blobs if blob.genet in genets]
48+ # for blob in blobs:
49+ # self.viewerplus.setBlobClass(blob, self.active_label)
5850
5951 message = "[TOOL][ASSIGN] Blob(s) assigned ({:d}) (CLASS={:s})." .format (len (self .viewerplus .selected_blobs ), self .active_label )
6052 self .viewerplus .logfile .info (message )
0 commit comments