Measure intensity in masked images

Hi,

the software crashes when measuring intensities on a masked image that has no valid pixels (i.e. there is no pixel within the mask)

Traceback (most recent call last):
File “cellprofiler\pipeline.pyc”, line 305, in run
File “cellprofiler\modules\measureobjectintensity.pyc”, line 368, in run
IndexError: index %Ld out of bounds 0<=index<%Ld

something goes wrong in the quantile measurements.
probably the code is not made for dealing with no entries (which is understandable…)

for indices in (indices_25, indices_50, indices_75):
imask = indices > max_indices
indices[imask] = max_indices[imask]
lower_quartile_intensity = flat_img[image_idx[indices_25]]
median_intensity = flat_img[image_idx[indices_50]]
upper_quartile_intensity = flat_img[image_idx[indices_75]

i think it could be useful to fix this, because it may happen in some assays (like mine :smile: that there are no objects detected in certain images.

regards,
Tischi

Thanks for pointing this out. We’ve filling a bug report on this, so we’ll address it in time for the next release.
-Mark

Our latest release, r10415, fixes this issue.
-Mark