private void AddNoise(double power, Processor processor)
        {
            Complex[,] noise = new Complex[processor.Dim, processor.Dim];
            Random rnd = new Random();

            for (int j = 0; j < processor.Dim; ++j)
            {
                for (int i = 0; i < processor.Dim; ++i)
                {
                    double ns = 0;
                    for (int n = 0; n < 20; ++n)
                    {
                        ns += rnd.NextDouble();
                    }
                    noise[i, j].Re = ns;
                }
            }

            double sigE = ImageProcessor.Processing.MathUtils.GetPictureEnergy(processor.Picture, processor.Dim);
            double noiseE = ImageProcessor.Processing.MathUtils.GetPictureEnergy(noise, processor.Dim);

            double norm = Math.Sqrt(sigE / noiseE) * (power / 100.0);

            for (int j = 0; j < processor.Dim; ++j)
            {
                for (int i = 0; i < processor.Dim; ++i)
                {
                    processor.Picture[i, j].Re += noise[i, j].Re * norm;
                }
            }
        }
        public static void CallPlugin(string name, Processor processor)
        {
            IPlugin plugin = plugins[name];
            WindowManager windowManager = new WindowManager(plugin);
            Host host = new Host(processor, windowManager);

            try
            {
                plugin.Process(host);
            }
            catch(Exception e)
            {
                windowManager.ShowMessage(string.Format("{0}\n{1}",
                    e.Message, e.StackTrace));
            }
        }
 public Host(Processor processor, WindowManager windowManager)
 {
     this.processor = processor;
     this.windowManager = windowManager;
 }