CheckConnect.m can be used to test connected area