/**
   * 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);
  }
  public static <T extends ImageBase> ImageSegmentation<T> fh04(
      ConfigFh04 config, ImageType<T> imageType) {
    if (config == null) config = new ConfigFh04();

    SegmentFelzenszwalbHuttenlocher04<T> fh = FactorySegmentationAlg.fh04(config, imageType);

    return new Fh04_to_ImageSegmentation<T>(fh, config.connectRule);
  }
  public static <T extends ImageBase> ImageSegmentation<T> meanShift(
      ConfigSegmentMeanShift config, ImageType<T> imageType) {
    if (config == null) config = new ConfigSegmentMeanShift();

    SegmentMeanShift<T> ms = FactorySegmentationAlg.meanShift(config, imageType);

    return new MeanShift_to_ImageSegmentation<T>(ms, config.connectRule);
  }
  public static <T extends ImageBase> ImageSegmentation<T> slic(
      ConfigSlic config, ImageType<T> imageType) {
    SegmentSlic<T> ms = FactorySegmentationAlg.slic(config, imageType);

    return new Slic_to_ImageSegmentation<T>(ms);
  }