A Black Line in Terrain Correct Map

The only way to correctly mask out low coherence areas is described here: Is it the right way to create mask for phase unwrapping?

But it only works if the remaining areas are large enough and connected