Skip to content
Snippets Groups Projects
Commit b30da837 authored by Laurent Guerard's avatar Laurent Guerard
Browse files

Refactor fiber typing to use loop

parent 387af8a7
No related branches found
No related tags found
No related merge requests found
......@@ -528,29 +528,21 @@ positive_c2_c3 = list( set(all_fiber_subsets[1]).intersection(all_fiber_subsets[
positive_c1_c2_c3 = list( set(positive_c1_c2).intersection(all_fiber_subsets[2]) )
# update ROI color & results table for double and triple positives
if len(positive_c1_c2) > 0:
preset_results_column( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_2) + " positive (magenta)", "NO" )
change_subset_roi_color(rm, positive_c1_c2, "magenta")
save_selected_rois( rm, positive_c1_c2, output_dir + "/" + raw_image_title + "_positive_fiber_rois_c" + str(fiber_channel_1) + "_c" + str(fiber_channel_2) + ".zip")
add_results( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_2) + " positive (magenta)", positive_c1_c2, "YES")
if len(positive_c1_c3) > 0:
preset_results_column( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_3) + " positive (yellow)", "NO" )
change_subset_roi_color(rm, positive_c1_c3, "yellow")
save_selected_rois( rm, positive_c1_c3, output_dir + "/" + raw_image_title + "_positive_fiber_rois_c" + str(fiber_channel_1) + "_c" + str(fiber_channel_3) + ".zip")
add_results( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_3) + " positive (yellow)", positive_c1_c3, "YES")
if len(positive_c2_c3) > 0:
preset_results_column( rt, "channel " + str(fiber_channel_2) + "," + str(fiber_channel_3) + " positive (cyan)", "NO" )
change_subset_roi_color(rm, positive_c2_c3, "cyan")
save_selected_rois( rm, positive_c2_c3, output_dir + "/" + raw_image_title + "_positive_fiber_rois_c" + str(fiber_channel_2) + "_c" + str(fiber_channel_3) + ".zip")
add_results( rt, "channel " + str(fiber_channel_2) + "," + str(fiber_channel_3) + " positive (cyan)", positive_c2_c3, "YES")
if len(positive_c1_c2_c3) > 0:
preset_results_column( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_2) + "," + str(fiber_channel_3) + " positive(white)", "NO" )
change_subset_roi_color(rm, positive_c1_c2_c3, "white")
save_selected_rois( rm, positive_c1_c2_c3, output_dir + "/" + raw_image_title + "_positive_fiber_rois_c" + str(fiber_channel_1) + "_c" + str(fiber_channel_2) + "_c" + str(fiber_channel_3) + ".zip")
add_results( rt, "channel " + str(fiber_channel_1) + "," + str(fiber_channel_2) + "," + str(fiber_channel_3) + " positive(white)", positive_c1_c2_c3, "YES")
channels = [
(positive_c1_c2, [fiber_channel_1, fiber_channel_2], "magenta"),
(positive_c1_c3, [fiber_channel_1, fiber_channel_3], "yellow"),
(positive_c2_c3, [fiber_channel_2, fiber_channel_3], "cyan"),
(positive_c1_c2_c3, [fiber_channel_1, fiber_channel_2, fiber_channel_3], "white")
]
for positives, ch_nums, color in channels:
if positives:
ch_str = ",".join(map(str, ch_nums))
color_label = "channel %s positive (%s)" % (ch_str, color)
preset_results_column(rt, color_label.replace(',', '-'), "NO")
change_subset_roi_color(rm, positives, color)
save_selected_rois(rm, positives, "%s/%s_positive_fiber_rois_c%s.zip" % (output_dir, raw_image_title, '_c'.join(map(str, ch_nums))))
add_results(rt, color_label.replace(',', '-'), positives, "YES")
# save all results together
save_all_rois( rm, output_dir + "/" + raw_image_title + "_all_fiber_type_rois_color-coded.zip" )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment