Skip to content

Commit

Permalink
Catch "no objects of any type"
Browse files Browse the repository at this point in the history
  • Loading branch information
bethac07 committed Dec 13, 2022
1 parent 9006c7a commit 7ca541f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cellprofiler/modules/exporttospreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,12 +1406,16 @@ def make_object_file(
writer.writerow([x[i] for x in features])

for img_number in image_set_numbers:
object_count = numpy.max(
[
m.get_measurement(IMAGE, "Count_%s" % name, img_number)
for name in object_names
]
)
try:
object_count = numpy.max(
[
m.get_measurement(IMAGE, "Count_%s" % name, img_number)
for name in object_names
]
)
except TypeError:
#If no objects are found in the image, we can't find the max of nan's - 4653
object_count = 0
object_count = int(object_count) if object_count and not numpy.isnan(object_count) else 0
columns = [
numpy.repeat(img_number, object_count)
Expand Down

0 comments on commit 7ca541f

Please sign in to comment.