oldBodyParts = self.dataFrame.columns.get_level_values(1)
_, idx = np.unique(oldBodyParts, return_index=True)
oldbodyparts2plot = list(oldBodyParts[np.sort(idx)])
self.new_bodyparts = list(set(self.bodyparts) - set(oldbodyparts2plot))
// Checking if user added a new label
if self.new_bodyparts==[]: // i.e. no new label
self.figure,self.axes,self.canvas,self.toolbar = self.image_panel.drawplot(self.img,img_name,self.iter,self.index,self.bodyparts,self.colormap)
After Change
self.markerSize = self.cfg["dotsize"]
self.alpha = self.cfg["alphavalue"]
self.colormap = plt.get_cmap(self.cfg["colormap"])
self.colormap = self.colormap.reversed()
self.project_path=self.cfg["project_path"]
self.index =np.sort([fn for fn in glob.glob(os.path.join(self.dir,"*.png")) if ("labeled.png" not in fn)])
self.statusbar.SetStatusText("Working on folder: {}".format(os.path.split(str(self.dir))[-1]))
self.relativeimagenames=["labeled"+n.split("labeled")[1] for n in self.index]//[n.split(self.project_path+"/")[1] for n in self.index]