Created a multiChannelApplyMask function based on a nice solution I found in a GitHub issue