code to threshold corrmat and convert to srcdst