new functions for filtering labeled images