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

Add method for measuring mean intensity in all fibers

parent c4deda24
No related branches found
No related tags found
No related merge requests found
...@@ -114,20 +114,21 @@ def measure_mean_of_rois(imp, channel, rm): ...@@ -114,20 +114,21 @@ def measure_mean_of_rois(imp, channel, rm):
The channel on which to measure. starts at 1. The channel on which to measure. starts at 1.
rm : ij.plugin.frame.RoiManager rm : ij.plugin.frame.RoiManager
A reference of the IJ-RoiManager. A reference of the IJ-RoiManager.
min_intensity : int
The selection criterion (here: intensity threshold).
Returns Returns
------- -------
list list of float
A selection of ROIs which passed the selection criterion (are above the threshold). A list of mean intensity values for each ROI in the specified channel.
""" """
imp.setC(channel) imp.setC(channel)
all_rois = rm.getRoisAsArray() all_rois = rm.getRoisAsArray()
mean_intensities = []
for i, roi in enumerate(all_rois): for i, roi in enumerate(all_rois):
imp.setRoi(roi) imp.setRoi(roi)
stats = imp.getStatistics() stats = imp.getStatistics()
mean_intensities.append(stats.mean)
return mean_intensities
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment