modification for more alleles for graphcut