Exemplo n.º 1
0
 private void dgZScanPoints_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
 {
     if (dgZScanPoints.SelectedItem != null)
     {
         mSelectedScanPoint = ((ScanLevel)dgZScanPoints.SelectedItem);
         drawHeatMapFromFile(mLogFileName + ".csv", Convert.ToString(mSelectedScanPoint.ZPos), dgZScanPoints.SelectedIndex);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the area for where the probe will need to scan
        /// </summary>
        private void setScanArea()
        {
            // Crop down the image to the selected region
            mCanvasScanArea = Utilities.determineOpositeCorners(mCanvasMouseDownPos, mCanvasMouseUpPos);

            // Zoom in on the scan area
            ImageSource lImage = ImagingMinipulation.cropImage(imageCaptured, mCanvasScanArea[0], mCanvasScanArea[1]);
            imageCaptured.Source = lImage;

            // Convert the bounds to an actual motor positions
            mMotorScanArea[0].X = Math.Round((mCanvasScanArea[0].X - mCanvasCalibrationPoints[0].X) / mCanvasXYStepSize, 0, MidpointRounding.ToEven);
            mMotorScanArea[0].Y = Math.Round((mCanvasScanArea[0].Y - mCanvasCalibrationPoints[0].Y) / mCanvasXYStepSize, 0, MidpointRounding.ToEven);
            mMotorScanArea[1].X = Math.Round((mCanvasScanArea[1].X - mCanvasCalibrationPoints[0].X) / mCanvasXYStepSize, 0, MidpointRounding.ToEven);
            mMotorScanArea[1].Y = Math.Round((mCanvasScanArea[1].Y - mCanvasCalibrationPoints[0].Y) / mCanvasXYStepSize, 0, MidpointRounding.ToEven);

            // Give the motors a starting position
            mMotorXPos = mMotorScanArea[0].X + (double)(mXYStepSize / 2);
            mMotorYPos = mMotorScanArea[0].Y + (double)(mXYStepSize / 2);
            mMotorZPos = mZMin;

            // Update the scan area width and length
            mXScanPoints = (int)Math.Round((mMotorScanArea[1].X - mMotorScanArea[0].X) / mXYStepSize);
            mYScanPoints = (int)Math.Round((mMotorScanArea[1].Y - mMotorScanArea[0].Y) / mXYStepSize);

            // Calculate how long it will take
            int numXYPlanes = (int)Math.Ceiling((double)(mZMax - mZMin) / (double)mZStepSize) + 1;

            mScans.Clear();
            for (int i = 0; i < numXYPlanes; i++)
            {
                int temp = (mZMin + (mZStepSize * i));
                if (temp > mZMax) temp = mZMax;
                ScanLevel lScan = new ScanLevel(temp);
                mScans.Add(lScan);
            }
            dgZScanPoints.ItemsSource = mScans;
            dgZScanPoints.SelectedIndex = 0;
            mCurrentZScanIndex = 0;

            mTotalScanPoints = Convert.ToInt32(mXScanPoints * mYScanPoints * numXYPlanes);

            mCDTimer = null;
            mCDTimer = new CountdownTimer(lblCDTimer, mTotalScanPoints);

            // Initialize the heatmap
            mHeatMap.Create((int)mXScanPoints, (int)mYScanPoints, IntensityColorKeyGrid);
        }