plot FOO using 1:2:3 mask with {pm3d|image}
Once a mask has been defined, you can use it as a filter to select only the region inside it from an image, pm3d, or contourfill plot. See masking.