From 7003049f6dc21462ae461664c51b0bcef503601f Mon Sep 17 00:00:00 2001 From: "kai.schleicher@unibas.ch" <kai.schleicher@unibas.ch> Date: Fri, 3 Feb 2023 14:38:29 +0100 Subject: [PATCH] fix bug that expected a certain channel sequence changed result table column and file naming accordingly --- 2c_fibertyping.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/2c_fibertyping.py b/2c_fibertyping.py index 91b8c6a..bb58eab 100755 --- a/2c_fibertyping.py +++ b/2c_fibertyping.py @@ -409,7 +409,7 @@ all_fiber_subsets =[ [], [], [] ] for index, fiber_channel in enumerate(all_fiber_channels): if fiber_channel > 0: - preset_results_column( rt, "channel " + str(fiber_channel) + " positive (" + roi_colors[fiber_channel-1] + ")", "NO" ) + preset_results_column( rt, "channel " + str(fiber_channel) + " positive (" + roi_colors[index] + ")", "NO" ) if all_min_fiber_intensities[index] == 0: all_min_fiber_intensities[index] = get_threshold_from_method(raw, fiber_channel, "Mean")[0] IJ.log( "fiber channel " + str(fiber_channel) + " intensity threshold: " + str(all_min_fiber_intensities[index]) ) @@ -418,7 +418,7 @@ for index, fiber_channel in enumerate(all_fiber_channels): if len(positive_fibers) > 0: change_subset_roi_color(rm, positive_fibers, roi_colors[index]) save_selected_rois( rm, positive_fibers, output_dir + "/" + raw_image_title + "_positive_fiber_rois_c" + str( fiber_channel ) + ".zip") - add_results( rt, "channel " + str(fiber_channel) + " positive (" + roi_colors[fiber_channel-1] + ")", positive_fibers, "YES") + add_results( rt, "channel " + str(fiber_channel) + " positive (" + roi_colors[index] + ")", positive_fibers, "YES") # single positive positive_c1 = all_fiber_subsets[0] @@ -433,28 +433,28 @@ 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 1,2 positive (magenta)", "NO" ) + 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_c1_c2.zip") - add_results( rt, "channel 1,2 positive (magenta)", positive_c1_c2, "YES") + 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 1,3 positive (yellow)", "NO" ) + 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_c1_c3.zip") - add_results( rt, "channel 1,3 positive (yellow)", positive_c1_c3, "YES") + 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 2,3 positive (cyan)", "NO" ) + 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_c2_c3.zip") - add_results( rt, "channel 2,3 positive (cyan)", positive_c2_c3, "YES") + 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 1,2,3 positive (white)", "NO" ) + 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_c1_c2_c3.zip") - add_results( rt, "channel 1,2,3 positive (white)", positive_c1_c2_c3, "YES") + 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") # save all results together save_all_rois( rm, output_dir + "/" + raw_image_title + "_all_fiber_type_rois_color-coded.zip" ) -- GitLab