public void SetMethod(string MethodName, Image <Gray, Byte> sample_img) { if (!strategyNames.ContainsKey(MethodName)) { throw new Exception("SetMethod: method name incorrect!"); } else { Assembly assembly = Assembly.GetExecutingAssembly(); Type type = assembly.GetTypes() .First(t => t.Name == strategyNames[MethodName]); strategy = (IDenoiseStrategy)Activator.CreateInstance(type); strategy.PrepareDenoiseMethod(sample_img); } }
public CDenoiseMaster() { strategy = null; strategyNames = CReflectionTools.GetStrategyNamesFromNamespace("DiplomaMaster.DenoisingMethods", "CDenoise_"); }