Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Only draw a new ROI if the previous one is completed
if self.rois:
if not all(r.completed for r in self.rois.values()):
return
count = len(self.rois)
idx = count % len(self.color_cycle)
logger.debug("Creating new ROI {}".format(count))
if self.roi_names is not None and idx < len(self.roi_names):
roi_name = self.roi_names[idx]
else:
roi_name = str(count + 1)
self.ax.set_title("Draw ROI '{}'".format(roi_name))
plt.draw()
roi = RoiPoly(color=self.color_cycle[idx],
fig=self.fig,
ax=self.ax,
close_fig=False,
show_fig=False)
self.rois[roi_name] = roi
def roipoly(*args, **kwargs):
deprecation("Import 'RoiPoly' instead of 'roipoly'!")
return RoiPoly(*args, **kwargs)