Ejemplo n.º 1
0
        private void CreateCurveForGreylevelImageLineData(Point start, Point end)
        {
            TileView viewer = this.mosaicWindow.TileView;

            List <Tile> tiles = viewer.GetVisibleTiles();

            if (tiles == null)
            {
                return;
            }

            if (MosaicWindow.MosaicInfo.ColorDepth >= 24)
            {
                return;
            }

            int max_pixels = Math.Abs((end.X - start.X)) + Math.Abs((end.Y - start.Y));

            double[] values = new double[max_pixels];

            int len = 0;

            foreach (Tile tile in tiles)
            {
                if (tile.IsDummy)
                {
                    continue;
                }

                FreeImageAlgorithmsBitmap dib = tile.LoadFreeImageBitmap();

                len = dib.GetGreyScalePixelValuesAsDoublesForLine(start, end, out values);

                dib.Dispose();
            }

            PointPairList list = new PointPairList();

            double x, y;

            for (int i = 0; i < len; i++)
            {
                x = (double)i;
                y = (double)values[i];
                list.Add(x, y);
            }

            if (this.curve != null)
            {
                this.zedGraphControl.GraphPane.CurveList.Remove(this.curve);
            }

            this.curve = new LineItem("Profile", list, Color.Black, SymbolType.None);

            this.zedGraphControl.GraphPane.CurveList.Insert(0, curve);

            this.zedGraphControl.AxisChange();
        }