package yi.iu.processor.color.reg.merge;

import java.awt.Dimension;

/**
 * NeighborMerger merges the regions if they are taking the labels as specified.
 */

public interface NeighborMerger {
  /**
   * Constructs the neighour matrix.  matrix[i][j] is the number of neighour
   * instances that a i-labeled pixel is next to a j-labeled pixel.  It is
   * "Partially" because some pixels are not considered
   * @param labels the labels of each pixels
   * @param d the dimension of the label
   * @param mask the mask to specify which pixels are not considered.  When a
   *             pixel is not considered, the corresponding mask is "1"
   * @return the neighour matrix
   */
  public int[][] getNeighborMatrix(int[] labels, Dimension d, int[] mask);

  /**
   * Merges the regions if they are taking the labels as specified.
   * @param cluster_map
   * @param d
   * @param from
   * @param to
   * @param cc_labels
   * @param mask
   */
  public void mergeLabels(int[] cluster_map, Dimension d, int from, int to, int[] cc_labels, int[] mask);
}