/**
   * Creates an instance of {@link WatershedVincentSoille1991}. Watershed works better when initial
   * seeds are provided. In this adaptation of watershed to {@link ImageSegmentation} only the more
   * basic algorithm is used where each local minima is a region, which causes over segmentation.
   * Watershed also only can process gray scale U8 images. All other image types are converted into
   * that format.
   *
   * @see WatershedVincentSoille1991
   * @param config Configuration. If null default is used.
   * @param <T>
   * @return
   */
  public static <T extends ImageBase> ImageSegmentation<T> watershed(ConfigWatershed config) {
    if (config == null) config = new ConfigWatershed();

    WatershedVincentSoille1991 watershed = FactorySegmentationAlg.watershed(config.connectRule);

    return new Watershed_to_ImageSegmentation<T>(
        watershed, config.minimumRegionSize, config.connectRule);
  }