Beispiel #1
0
        public static void RunSingle()
        {
            var i = PixelFactory
                    .Create <float>(PixelSeqParam.Create("Config.yaml").Maps)
                    .Read(@"D:\200CFT\Lot0002\wafer01\N01_C170414_大きい点傷_左下\Dark\Ave.bin");

            var j = i.Sub(i.FilterMedianBayer());

            Console.WriteLine(j["Active"].SubSelf(255).ToColorBG().Labling());
        }
Beispiel #2
0
        public static Pixel <T> Cut <T>(this Pixel <T> src) where T : struct, IComparable
        {
            var dst = new T[src.Width * src.Height];

            for (int i = 0; i < dst.Length; i++)
            {
                dst[i] = src[i];
            }
            return(PixelFactory.Create(src.Width, src.Height, dst));
        }
Beispiel #3
0
        public Document()
        {
            #region MyRegion

            model = App.Container.Resolve <Model>();

            //ダミー画像
            model.FileNames.Add(this.ContentId, "null");
            model.raws.Add(this.ContentId, PixelFactory.Create <float>(1, 1));
            model.Developing(this.ContentId);

            #endregion


            #region MyRegion
            //タイトル
            FileName = model
                       .ObserveProperty(x => x.FileNames)
                       .Select(x => x.ContainsKey(this.ContentId) ? x[this.ContentId] : "null")
                       .ToReactiveProperty().AddTo(this.Disposable);
            FileName.Subscribe(x =>
            {
                Title = $"{System.IO.Path.GetFileName(x)}({x})";
            }).AddTo(this.Disposable);

            isLinkage = model.ObserveProperty(x => x.isLinkage).ToReactiveProperty().AddTo(this.Disposable);

            MouseWheel = model.ToReactivePropertyAsSynchronized(
                x => x.Scale,
                convert: x => (int)Math.Log(x, 2),
                convertBack: x => Math.Pow(2, x))
                         .AddTo(this.Disposable);


            ScrollBar = model.ToReactivePropertyAsSynchronized(
                x => x.ScrollBar,
                convert: x => { _ScrollBar = x; return(x); },
                convertBack: x => isLinkage.Value == true ? x : _ScrollBar)
                        .AddTo(this.Disposable);

            Scale = model.ObserveProperty(x => x.Scale).Where(_ => isLinkage.Value == true).ToReactiveProperty().AddTo(this.Disposable);



            img = model.ObserveProperty(x => x.Images).Select(x => x[this.ContentId]).ToReactiveProperty().AddTo(this.Disposable);

            Width  = img.CombineLatest(Scale, (x, y) => (x?.PixelWidth ?? 0) * y).ToReactiveProperty().AddTo(this.Disposable);
            Height = img.CombineLatest(Scale, (x, y) => (x?.PixelHeight ?? 0) * y).ToReactiveProperty().AddTo(this.Disposable);

            #endregion


            MouseMove = new ReactiveProperty <Point>().AddTo(this.Disposable);
            RectMove  = model.ToReactivePropertyAsSynchronized(x => x.Rect).AddTo(this.Disposable);

            Shapes = MouseMove.CombineLatest(RectMove, (x, y) =>
            {
                var i = new List <Shape>();
                DrawL(i, x);
                DrawShift(i, y);
                return(i);
            }).ToReactiveProperty().AddTo(this.Disposable);



            #region Command

            FileDropCommand = new ReactiveCommand().AddTo(this.Disposable);
            FileDropCommand.Subscribe(x =>
            {
                var i = x as string[];
                model.ReadFile(i[0], this.ContentId);
                model.Developing(this.ContentId);

                //if (ii == null)
                //{
                //    NotificationRequest.Raise(new Notification
                //    {
                //        Content = "Notification Message",
                //        Title = "Notification"
                //    });
                //}
                //else
                //{
                //    imgmodel.ReadFile(ii, i[0]);
                //}
            }).AddTo(this.Disposable);

            ReLoadCommand = new ReactiveCommand().AddTo(this.Disposable);
            ReLoadCommand.Subscribe(x =>
            {
                var buf = model.FileNames.ContainsKey(this.ContentId) ? model.FileNames[this.ContentId] : "";
                if (System.IO.File.Exists(buf))
                {
                    model.ReadFile(buf, this.ContentId);
                    model.Developing(this.ContentId);
                }
            }).AddTo(this.Disposable);

            ReLoadAndRunCommand = new ReactiveCommand().AddTo(this.Disposable);
            ReLoadAndRunCommand.Subscribe(x =>
            {
                var buf = model.FileNames.ContainsKey(this.ContentId) ? model.FileNames[this.ContentId] : "";
                if (System.IO.File.Exists(buf))
                {
                    model.ReadFile(buf, this.ContentId);
                    model.ScriptRun(this.ContentId);
                    model.Developing(this.ContentId);
                }
            }).AddTo(this.Disposable);

            ScriptRunCommand = new ReactiveCommand().AddTo(this.Disposable);
            ScriptRunCommand.Subscribe(x =>
            {
                model.ScriptRun(this.ContentId);
                model.Developing(this.ContentId);
            }).AddTo(this.Disposable);
            #endregion
        }