diff --git a/2d_spots_in_fibers.py b/2d_spots_in_fibers.py index 41ca9e458357aad65807cfbda249bfbd13ce723c..23751d0e567e3d0b896c8ddcb3760d80b2f73909 100644 --- a/2d_spots_in_fibers.py +++ b/2d_spots_in_fibers.py @@ -776,16 +776,15 @@ results_table = ResultsTable() for index, channel in enumerate(processing_channels): channel = int(channel) quality_threshold = float(quality_thresholds[index]) - spots_channel = BFopen_image(path_to_image, channel, series_number) # can be a stack - spots_label_imp = run_trackmate_dog_spot_detector(spots_channel, quality_threshold) # spot detection is 3D + spots_channel = BFopen_image(path_to_image, channel, series_number) + spots_label_imp = run_trackmate_dog_spot_detector(spots_channel, quality_threshold) save_image_as_IJtif(spots_label_imp, filename, "spots_ch" + str(channel), parent_dir) save_labelimage_as_ijroiset(spots_label_imp, filename, "spots_ch" + str(channel), parent_dir) - spots_binary_imp = convert_labelimage_to_binary(spots_label_imp) # can be a stack - spots_binary_imp_sum_proj = ZProjector.run(spots_binary_imp, "sum") # if 2 (n) spots perfecly overlap in z, the pixel value will be 2 (n) - dapi_positive_spots_binary = ImageCalculator.run(spots_binary_imp_sum_proj, dapi_binary, "Multiply create") - dapi_negative_spots_binary = ImageCalculator.run(spots_binary_imp_sum_proj, dapi_positive_spots_binary, "Subtract create") + spots_binary_imp = convert_labelimage_to_binary(spots_label_imp) + dapi_positive_spots_binary = ImageCalculator.run(spots_binary_imp, dapi_binary, "Multiply create") + dapi_negative_spots_binary = ImageCalculator.run(spots_binary_imp, dapi_positive_spots_binary, "Subtract create") - n_spots_per_fiber = measure_intensity_sum(fibers_label_imp, spots_binary_imp_sum_proj) + n_spots_per_fiber = measure_intensity_sum(fibers_label_imp, spots_binary_imp) n_dapi_positive_spots_per_fiber = measure_intensity_sum(fibers_label_imp, dapi_positive_spots_binary) n_dapi_negative_spots_per_fiber = measure_intensity_sum(fibers_label_imp, dapi_negative_spots_binary) @@ -794,7 +793,7 @@ for index, channel in enumerate(processing_channels): add_results_to_resultstable(results_table, "n spots channel " + str(channel), n_spots_per_fiber[1]) add_results_to_resultstable(results_table, "n spots dapi positive channel " + str(channel), n_dapi_positive_spots_per_fiber[1]) add_results_to_resultstable(results_table, "n spots dapi negative channel " + str(channel), n_dapi_negative_spots_per_fiber[1]) - close_images([spots_channel, spots_label_imp, spots_binary_imp, spots_binary_imp_sum_proj, dapi_binary, dapi_positive_spots_binary, dapi_negative_spots_binary]) + close_images([spots_channel, spots_label_imp, spots_binary_imp, spots_binary_imp, dapi_binary, dapi_positive_spots_binary, dapi_negative_spots_binary]) results_table.show("Spots") save_results_table(results_table, filename, "Spots", parent_dir)