Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def clear_radio_buttons(self):
"""Clears the radio button"""
# enabling default rating encourages lazy advancing without review
# self.radio_bt_rating.set_active(cfg.index_freesurfer_default_rating)
for index, label in enumerate(self.radio_bt_rating.labels):
if label.get_text() == self.radio_bt_rating.value_selected:
self.radio_bt_rating.circles[index].set_facecolor(
cfg.color_rating_axis)
break
self.radio_bt_rating.value_selected = None
fig.text(cfg.position_annot_text[0], cfg.position_annot_text[1], **cfg.annot_text_props)
# right above the rating area (blinking perhaps?)
if self.flagged_as_outlier and outlier_alerts is not None:
ax_alert = plt.axes(cfg.position_outlier_alert_box)
ax_alert.axis('off')
h_rect = Rectangle((0, 0), 1, 1, zorder=-1, facecolor='xkcd:coral', alpha=0.25)
ax_alert.add_patch(h_rect)
alert_msg = 'Flagged as an outlier'
fig.text(cfg.position_outlier_alert[0], cfg.position_outlier_alert[1],
alert_msg, **cfg.annot_text_props)
for idx, cause in enumerate(outlier_alerts):
fig.text(cfg.position_outlier_alert[0], cfg.position_outlier_alert[1] - (idx+1) * 0.02,
cause, color=cfg.alert_colors_outlier[cause], **cfg.annot_text_props)
ax_radio = plt.axes(cfg.position_rating_axis, facecolor=cfg.color_rating_axis, aspect='equal')
self.radio_bt_rating = RadioButtons(ax_radio, self.rating_list,
active=None, activecolor='orange')
self.radio_bt_rating.on_clicked(self.save_rating)
for txt_lbl in self.radio_bt_rating.labels:
txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
for circ in self.radio_bt_rating.circles:
circ.set(radius=0.06)
# ax_quit = plt.axes(cfg.position_navig_options, facecolor=cfg.color_quit_axis, aspect='equal')
# self.radio_bt_quit = RadioButtons(ax_quit, navig_options,
# active=None, activecolor='orange')
# self.radio_bt_quit.on_clicked(self.advance_or_quit)
# for txt_lbl in self.radio_bt_quit.labels:
# txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
def clear_radio_buttons(self):
"""Clears the radio button"""
# enabling default rating encourages lazy advancing without review
# self.radio_bt_rating.set_active(cfg.index_freesurfer_default_rating)
for index, label in enumerate(self.radio_bt_rating.labels):
if label.get_text() == self.radio_bt_rating.value_selected:
self.radio_bt_rating.circles[index].set_facecolor(cfg.color_rating_axis)
break
self.radio_bt_rating.value_selected = None
def clear_radio_buttons(self):
"""Clears the radio button"""
# enabling default rating encourages lazy advancing without review
# self.radio_bt_rating.set_active(cfg.index_freesurfer_default_rating)
for index, label in enumerate(self.radio_bt_vis_type.labels):
if label.get_text() == self.radio_bt_vis_type.value_selected:
self.radio_bt_vis_type.circles[index].set_facecolor(cfg.color_rating_axis)
break
self.radio_bt_vis_type.value_selected = None
def clear_radio_buttons(self):
"""Clears the radio button"""
# enabling default rating encourages lazy advancing without review
# self.radio_bt_rating.set_active(cfg.index_freesurfer_default_rating)
for index, label in enumerate(self.radio_bt_vis_type.labels):
if label.get_text() == self.radio_bt_vis_type.value_selected:
self.radio_bt_vis_type.circles[index].set_facecolor(
cfg.color_rating_axis)
break
self.radio_bt_vis_type.value_selected = None
def add_checkboxes(self):
"""
Checkboxes offer the ability to select multiple tags such as Motion, Ghosting Aliasing etc,
instead of one from a list of mutual exclusive rating options (such as Good, Bad, Error etc).
"""
ax_checkbox = plt.axes(cfg.position_checkbox_t1_mri, facecolor=cfg.color_rating_axis)
# initially de-activating all
actives = [False] * len(self.issue_list)
self.checkbox = CheckButtons(ax_checkbox, labels=self.issue_list, actives=actives)
self.checkbox.on_clicked(self.save_issues)
for txt_lbl in self.checkbox.labels:
txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
for rect in self.checkbox.rectangles:
rect.set_width(cfg.checkbox_rect_width)
rect.set_height(cfg.checkbox_rect_height)
# lines is a list of n crosses, each cross (x) defined by a tuple of lines
for x_line1, x_line2 in self.checkbox.lines:
x_line1.set_color(cfg.checkbox_cross_color)
x_line2.set_color(cfg.checkbox_cross_color)
def add_radio_buttons_rating(self):
ax_radio = plt.axes(cfg.position_alignment_radio_button_rating,
facecolor=cfg.color_rating_axis, aspect='equal')
self.radio_bt_rating = RadioButtons(ax_radio, self.rating_list,
active=None, activecolor='orange')
self.radio_bt_rating.on_clicked(self.save_rating)
for txt_lbl in self.radio_bt_rating.labels:
txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
for circ in self.radio_bt_rating.circles:
circ.set(radius=0.06)
def add_radio_buttons(self):
ax_radio = plt.axes(cfg.position_radio_buttons,
facecolor=cfg.color_rating_axis, aspect='equal')
self.radio_bt_rating = RadioButtons(ax_radio, self.rating_list,
active=None, activecolor='orange')
self.radio_bt_rating.on_clicked(self.save_rating)
for txt_lbl in self.radio_bt_rating.labels:
txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
for circ in self.radio_bt_rating.circles:
circ.set(radius=0.06)
def add_process_options(self):
ax_radio = plt.axes(cfg.position_radio_bt_t1_mri,
facecolor=cfg.color_rating_axis)
self.radio_bt_vis_type = RadioButtons(ax_radio, cfg.vis_choices_defacing,
active=None, activecolor='orange')
self.radio_bt_vis_type.on_clicked(self.processing_choice_callback)
for txt_lbl in self.radio_bt_vis_type.labels:
txt_lbl.set(color=cfg.text_option_color, fontweight='normal')
for circ in self.radio_bt_vis_type.circles:
circ.set(radius=0.06)