added region growing code