Beispiel #1
0
        /* Zoom
         * 1. 이벤트로 받은 포인트를 가져온다.
         * 2. 포인트를 정렬한다.
         * 3. ZoomData에 방금 구한 데이터들을 넣는다.
         * 4. 이제 위에서 구한 데이터로 매트릭스 리스트를 만든다.
         *
         */
        public async Task <BitmapSource> StartZoom(System.Windows.Point startPoint, System.Windows.Point endPoint)
        {
            if (ImgPathBox == null)
            {
                return(null);
            }
            else
            {
                try
                {
                    System.Windows.Point realstart = new System.Windows.Point();
                    System.Windows.Point realend   = new System.Windows.Point();
                    ZomClass.CalcRealWH(scalData.OriginalScale, ConData, startPoint, endPoint, out realstart, out realend); // 실제 이미지의 픽셀위치로 변환
                    ZomData = ZomClass.SetStartEndPoint(realstart, realend, ImgInfo.W, ImgInfo.H);                          // ZoomData 세팅
                    List <List <byte[, ]> > splitedmat = await asyList2ScaledmatList(ImgPathBox, ZomData);

                    Stm = new StitchMatrix();
                    byte[,] stitchedArr = Stm.StitchArr(splitedmat);
                    BitmapSource output = await Task.Run(() => CreateBitmapSourceClass.CreateBitmapSource(stitchedArr));

                    ZoomGray = output;
                    await Task.Run(() => ZoomRain = Arr2Source( stitchedArr, ColorCovMode.Rainbow ));

                    await Task.Run(() => ZoomHsv = Arr2Source( stitchedArr, ColorCovMode.HSV ));

                    return(output);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    return(null);
                }
            }
        }
Beispiel #2
0
        /* 시퀀스
         * 1. string[,] 으로 파일 경로 매트릭스 만들기
         * 2. 줌을 하는 파일의 갯수 + 원본 파일의 크기로 스케일 정하기.
         * 3. 줌하는 영역 계산. (시작하는 파일 끝나는 파일, 각 파일별로 시작 끝점 계산)
         * 4. 각 영역의 데이터를 매트릭스로 가져온다.
         * 5. 각 영역의 데이터 매트릭스를 리스케일링 한다.
         * 6. 각 영역의 리스케일링 된 매트릭스를 합친다.
         * 7. 합쳐진 매트릭스를 비트맵소스로 변환한다.
         */

        private async void canvRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            ZoomClass    zom  = new ZoomClass();
            StitchMatrix smat = new StitchMatrix();

            canvRoot.Children.Remove(rect);

            #region Zoom
            if ((Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) && CtrlPushed == true)
            {
                txbZoomStatus.Text = "Busy";
                endPoint           = e.GetPosition(canvRoot);

                imgzommed.Source = await Mainmod.StartZoom(startPoint, endPoint);

                txbZoomStatus.Text     = "Ready";
                rbtnZoomGray.IsChecked = true;
            }
            #endregion

            #region Line Profile
            if ((Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt)) && AltPushed == true)
            {
                txbZoomStatus.Text = "Busy";
                endLinePoint       = e.GetPosition(canvRoot);
                byte[] result = await Mainmod.AsyStartProfile(startLinePoint, endLinePoint);

                AltPushed = false;

                await Task.Run((Action)(() => lineProChart.Dispatcher.BeginInvoke((Action)(() => AsySetLineValue(Arr2List(result), seriesbox)))));

                txbZoomStatus.Text = "Ready";
            }
            #endregion
            Mouse.OverrideCursor = null;
        }