Add masking to FLANN