/// <summary>
 /// Converts the kernel of the given filter to its equivalent string representation
 /// </summary>
 /// <param name="filter"> Input filter object </param>
 /// <returns> Filter kernel as string </returns>
 public static String Serialize(Filter filter)
 {
     StringBuilder sb = new StringBuilder();
     for (int p = 1; p <= filter.Size; p++)
     {
         sb.Append(filter.Kernel[p - 1]);
         sb.Append((p % filter.Dimension == 0) ? ";\n" : "; ");
     }
     return sb.ToString();
 }
        private void OnSuccessDisplayFilter(Filter filter)
        {
            // update filter properties shown
            view.NormalizeProperty = FormatFilter.NormalizeProperty(filter);
            view.KernelSizeProperty = FormatFilter.SizeProperty(filter);
            view.FilterTitleColor = Color.MediumAquamarine;

            // update the filter's kernel only if it's changed
            string filterAsText = FormatFilter.Serialize(filter);
            if (string.Compare(filterAsText, view.KernelText, StringComparison.Ordinal) != 0)
            {
                view.KernelText = filterAsText;
            }
        }
 private void StoreSelectedFilter(Filter filter)
 {
     selectedFilter = filter;
 }
 /// <summary>
 /// Return the string-formatted size property of the given filter
 /// </summary>
 /// <param name="filter"> Input filter </param>
 /// <returns> Formatted size property </returns>
 public static string SizeProperty(Filter filter)
 {
     return "Size=[" + filter.Dimension + "]x[" + filter.Dimension + "]";
 }
 /// <summary>
 /// Return the string-formatted normalize property of the given filter
 /// </summary>
 /// <param name="filter"> Input filter </param>
 /// <returns> Formatted normalize property </returns>
 public static string NormalizeProperty(Filter filter)
 {
     return filter.Normalized ? "Is normalized" : "Not normalized";
 }