Is inverting images necessary for analysis?

I am still very new to cellprofiler and image processing in general, and I was wondering if inverting the grayscale images is necessary for analysis. I understand the concept of it and what it does, but I can’t seem to figure out why it is necessary in cell profiler? Thank you so much!

Inversion can be necessary to perform some operations such as morphological operations. For example, erosion shrinks the boundaries of white/foreground regions so it matters which pixels are white/foreground. There are examples here.