示例#1
0
        public static void SaveRectData(string filename, vtkPolyData polyData, Rectangle rect)
        {
            try
            {
                SimplePointFile.OpenWriteFile(filename);

                var color = polyData.GetPointData().GetScalars();

                for (var i = 0; i < rect.Height; i++)
                {
                    for (var j = 0; j < rect.Width; j++)
                    {
                        var data = polyData.GetPoint(i * rect.Width + j);
                        var c    = color.GetComponent(i * rect.Width + j, 0);

                        SimplePointFile.Writeline(new[] { data[0], data[1], data[2], c, c, c });
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                SimplePointFile.CloseWriteFile();
            }
        }
示例#2
0
        public static void SaveData(int ratio, string filename)
        {
            try
            {
                SimplePointFile.OpenWriteFile(filename);

                var color = PolyData.GetPointData().GetScalars();

                for (var i = 0; i < ImageHeight; i += ratio)
                {
                    for (var j = 0; j < ImageWidth; j += ratio)
                    {
                        var data = PolyData.GetPoint(i * ImageWidth + j);
                        var c    = color.GetComponent(i * ImageWidth + j, 0);
                        SimplePointFile.Writeline(new[] { data[0] / ratio, data[1] / ratio, data[2], c, c, c });
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                SimplePointFile.CloseWriteFile();
            }
        }