Any reason that you changed the above. I find the compress much less idiomatic and harder to read.

The conversion to bool shouldn't be required: looking from where mask comes, it shouldn't be necessary as the mask could be created directly bool.