To create the mask, just extract the luminance, and apply a threshold (Binarize process).
I think that for most operations, you'll be fine with the mask. There may appear some boundary artefacts if you use convolutions or morphological filters, but in general it won't be a problem.
Oh, btw, if you want to extract statistical parameters, the easiest way is to create a preview inside the brick.