@@ -281,7 +281,7 @@ def run_image_pair_objects(
281281 RWC1 = numpy .zeros (len (lrange ))
282282 RWC2 = numpy .zeros (len (lrange ))
283283
284- # Threshold as percentage of maximum intensity of objects in each channel
284+ # List of thresholds for each object ( as percentage of maximum intensity of objects in each channel
285285 # Single threshold per object (it is calculated based on the highest pixel intensity in each object)
286286 tff = (self .thr .value / 100 ) * fix (
287287 scipy .ndimage .maximum (first_pixels , labels , lrange )
@@ -315,14 +315,9 @@ def run_image_pair_objects(
315315 first_pixels_perObj = first_pixels [labels == label ]
316316 second_pixels_perObj = second_pixels [labels == label ]
317317
318- # Local threshold for each object individually
319- thr_fi_perObj = self .thr .value * numpy .max (first_pixels_perObj ) / 100
320- thr_si_perObj = self .thr .value * numpy .max (second_pixels_perObj ) / 100
321-
322- #combined_thersh is an boolean array representing all the pixels in a single object, that is True in any pixel where BOTH fi and si are above their respective threshold
323- #is thr_fi == tff[labels==label] ??
324- # combined_thresh_perObj = (first_pixels[labels==label] > tff[labels==label]) & (second_pixels[labels==label] > tss[labels==label])
325- combined_thresh_perObj = (first_pixels_perObj > thr_fi_perObj ) & (second_pixels_perObj > thr_si_perObj )
318+ #combined_thresh_perObj is an boolean array representing all the pixels in a single object
319+ # It is True in any pixel where BOTH first_pixels_perObj and second_pixels_perObj are above their respective threshold
320+ combined_thresh_perObj = (first_pixels_perObj > tff [label - 1 ]) & (second_pixels_perObj > tss [label - 1 ])
326321
327322 # sum of the above-threshold (for both channels) pixel intensities per object
328323 tot_fi_thr_perObj = scipy .ndimage .sum (
0 commit comments