/// <summary>
        /// Initializes a new instance of the <see cref="SpectralSegmentation" /> class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameters">The parameters.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The source is null.
        /// or
        /// The method is null.
        /// or
        /// The method requires parameters which are not specified.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// The parameters do not contain a required parameter value.
        /// or
        /// The type of a parameter does not match the type specified by the method.
        /// or
        /// The value of a parameter is not within the expected range.
        /// or
        /// The specified source and result are the same objects, but the method does not support in-place operations.
        /// or
        /// The source geometry does not contain raster data.
        /// or
        /// The raster format of the source is not supported by the method.
        /// </exception>
        protected SpectralSegmentation(ISpectralGeometry source, ISpectralGeometry target, SpectralOperationMethod method, IDictionary <OperationParameter, Object> parameters)
            : base(source, target, method, parameters)
        {
            if (source.Raster == null)
            {
                throw new ArgumentException("The source geometry does not contain raster data.", "source");
            }
            if (!method.SupportedFormats.Contains(source.Raster.Format))
            {
                throw new ArgumentException("The raster format of the source is not supported by the method.", "source");
            }

            if (IsProvidedParameter(SpectralOperationParameters.SpectralDistanceAlgorithm))
            {
                _distance = ResolveParameter <SpectralDistance>(SpectralOperationParameters.SpectralDistanceAlgorithm);
            }
            else if (IsProvidedParameter(SpectralOperationParameters.SpectralDistanceType))
            {
                _distance = (SpectralDistance)Activator.CreateInstance(ResolveParameter <Type>(SpectralOperationParameters.SpectralDistanceType));
            }
            else
            {
                _distance = new EuclideanDistance();
            }

            Factory = ResolveParameter <IGeometryFactory>(CommonOperationParameters.GeometryFactory, Source.Factory);

            if (Factory.GetFactory <IRasterFactory>() == null)
            {
                Factory = Source.Factory;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpectralClustering" /> class.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="target">The target.</param>
 /// <param name="method">The method.</param>
 /// <param name="parameters">The parameters.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The source is null.
 /// or
 /// The method is null.
 /// or
 /// The method requires parameters which are not specified.
 /// </exception>
 /// <exception cref="System.ArgumentException">
 /// The parameters do not contain a required parameter value.
 /// or
 /// The type of a parameter does not match the type specified by the method.
 /// or
 /// The value of a parameter is not within the expected range.
 /// or
 /// The specified source and result are the same objects, but the method does not support in-place operations.
 /// or
 /// The source geometry does not contain raster data.
 /// or
 /// The raster format of the source is not supported by the method.
 /// </exception>
 protected SpectralClustering(ISpectralGeometry source, ISpectralGeometry target, SpectralOperationMethod method, IDictionary <OperationParameter, Object> parameters)
     : base(source, target, method, parameters)
 {
     if (IsProvidedParameter(SpectralOperationParameters.ClusterCenterDistanceAlgorithm))
     {
         _clusterCenterDistance = ResolveParameter <SpectralDistance>(SpectralOperationParameters.ClusterCenterDistanceAlgorithm);
     }
     else if (IsProvidedParameter(SpectralOperationParameters.ClusterCenterDistanceType))
     {
         _clusterCenterDistance = (SpectralDistance)Activator.CreateInstance(ResolveParameter <Type>(SpectralOperationParameters.ClusterCenterDistanceType));
     }
     else
     {
         _clusterCenterDistance = _distance;
     }
 }