Skip to content

Commit

Permalink
cleanup and change F_RWC_FORMAT
Browse files Browse the repository at this point in the history
  • Loading branch information
emiglietta committed Dec 3, 2024
1 parent cb46ab9 commit f3029e4
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions active_plugins/measurerwcperobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
M_PER_OBJECT = "Within each object individually"

"""Feature name format for the RWC Coefficient measurement"""
F_RWC_FORMAT = "Correlation_RWC_%s_%s"
F_RWC_FORMAT = "Correlation_RWC_perObj_%s_%s"


class MeasureRWCperObj(Module):
Expand Down Expand Up @@ -363,18 +363,7 @@ def run_image_pair_objects(
# ...which will always be the case since the thr is calculated as a % of the max intensity pixel in each object
# ...unless the above-threshold pixels on one channel don't match the ones on the other, so I guess it makes sense...
if numpy.any(combined_thresh_perObj):
# RWC1 = numpy.array(
# scipy.ndimage.sum(
# fi_thresh_obj * weight_thresh_perObj
# )
# ) / numpy.array(tot_fi_thr_perObj)
# RWC2 = numpy.array(
# scipy.ndimage.sum(
# si_thresh_obj * weight_thresh_perObj
# )
# ) / numpy.array(tot_si_thr_perObj)

# RWC1 and 2 are arrays
# RWC1 and 2 are arrays with the RWC value for each object in the set
RWC1[label-1] = numpy.array(
scipy.ndimage.sum(
fi_thresh_obj * weight_thresh_perObj
Expand All @@ -386,35 +375,33 @@ def run_image_pair_objects(
)
) / numpy.array(tot_si_thr_perObj)

### update RWC1 and RWC2 with ther right position and the right values

result += [
[
first_image_name,
second_image_name,
object_name,
"Mean RWC coeff",
"Mean RWC_perObj coeff",
"%.3f" % numpy.mean(RWC1),
],
[
first_image_name,
second_image_name,
object_name,
"Median RWC coeff",
"Median RWC_perObj coeff",
"%.3f" % numpy.median(RWC1),
],
[
first_image_name,
second_image_name,
object_name,
"Min RWC coeff",
"Min RWC_perObj coeff",
"%.3f" % numpy.min(RWC1),
],
[
first_image_name,
second_image_name,
object_name,
"Max RWC coeff",
"Max RWC_perObj coeff",
"%.3f" % numpy.max(RWC1),
],
]
Expand All @@ -423,28 +410,28 @@ def run_image_pair_objects(
second_image_name,
first_image_name,
object_name,
"Mean RWC coeff",
"Mean RWC_perObj coeff",
"%.3f" % numpy.mean(RWC2),
],
[
second_image_name,
first_image_name,
object_name,
"Median RWC coeff",
"Median RWC_perObj coeff",
"%.3f" % numpy.median(RWC2),
],
[
second_image_name,
first_image_name,
object_name,
"Min RWC coeff",
"Min RWC_perObj coeff",
"%.3f" % numpy.min(RWC2),
],
[
second_image_name,
first_image_name,
object_name,
"Max RWC coeff",
"Max RWC_perObj coeff",
"%.3f" % numpy.max(RWC2),
],
]
Expand Down

0 comments on commit f3029e4

Please sign in to comment.