Exemple #1
0
        private void SaveFile(FileStream fileStream, double[,] data)
        {
            int rows = data.GetLength(0);
            int cols = data.GetLength(1);

            using (var sw = new StreamWriter(fileStream))
            {
                sw.WriteLine("DSAA");
                sw.WriteLine(rows.ToString() + " " + cols.ToString());
                sw.WriteLine(xmin.ToString() + " " + xmax.ToString());
                sw.WriteLine(ymin.ToString() + " " + ymax.ToString());
                var zmin = EdgeDetection.GetDataMin(data);
                var zmax = EdgeDetection.GetDataMax(data);
                sw.WriteLine(zmin.ToString() + " " + zmax.ToString());

                var line = new StringBuilder();
                for (int i = 0; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        line.Append(data[i, j]);
                        line.Append(" ");
                    }

                    sw.WriteLine(line.ToString());
                    line.Clear();
                }
            }
        }
Exemple #2
0
        private void FillRestore(object parameter)
        {
            int rows = anomalyData.GetLength(0);
            int cols = anomalyData.GetLength(1);

            resultData = new double[rows, cols];
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    if (secondData[i, j] == 1.70141e38)
                    {
                        resultData[i, j] = 1.70141e38;
                    }
                    else
                    {
                        resultData[i, j] = anomalyData[i, j];
                    }
                }
            }

            var zmin = EdgeDetection.GetDataMin(resultData);
            var zmax = EdgeDetection.GetDataMax(resultData);

            ResultMin = zmin;
            ResultMax = zmax;
            ResultMap = GetMap(resultData, zmin, zmax);
        }
Exemple #3
0
        private void GridSimplify(object parameter)
        {
            int rows = anomalyData.GetLength(0);
            int cols = anomalyData.GetLength(1);

            resultData = new double[51, 51];
            for (int i = 0; i < rows; i += 4)
            {
                for (int j = 0; j < cols; j += 4)
                {
                    resultData[i / 4, j / 4] = anomalyData[i, j];
                }
            }
            var zmin = EdgeDetection.GetDataMin(resultData);
            var zmax = EdgeDetection.GetDataMax(resultData);

            ResultMin = zmin;
            ResultMax = zmax;
            ResultMap = GetMap(resultData, zmin, zmax);
        }
Exemple #4
0
        private void Separate(object parameter)
        {
            int rows  = anomalyData.GetLength(0);
            int cols  = anomalyData.GetLength(1);
            int index = Convert.ToInt32(parameter);

            if (index == 0)
            {
                resultData = Separation.TrendAnalysis(anomalyData, power);
            }
            else if (index == 1)
            {
                resultData = Separation.FilterTrendAnalysis(anomalyData, FiltData, power);
            }
            else if (index == 2)
            {
                resultData = Separation.InterpolateCut(anomalyData, expendMethod, radius, times);
            }
            else if (index == 3)
            {
                resultData = Separation.MoveAverage(anomalyData, secondData, expendMethod, radiusMin, radiusMax, radiusTick, out int bestRadius);
                Radius     = bestRadius;
            }
            else if (index == 4)
            {
                resultData = Separation.MoveAverage(anomalyData, expendMethod, radius);
            }
            else if (index == 5)
            {
                resultData = Separation.FilterMoveAverage(anomalyData, FiltData, expendMethod, radius);
            }
            else if (index == 6)
            {
                resultData = FiltData;
            }
            else if (index == 7)
            {
                resultData = Separation.FilterProject(anomalyData, expendMethod, project);
            }
            else if (index == 8)
            {
                resultData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.延拓(FrqData, 延拓高度)).GetRe());
            }

            var zmin = EdgeDetection.GetDataMin(resultData);
            var zmax = EdgeDetection.GetDataMax(resultData);

            ResultMin = zmin;
            ResultMax = zmax;
            ResultMap = GetMap(resultData, zmin, zmax);

            if (index != 6)
            {
                secondResultData = new double[rows, cols];
                for (int i = 0; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        secondResultData[i, j] = anomalyData[i, j] - resultData[i, j];
                    }
                }
            }
            else
            {
                secondResultData = Separation.AverageFill(resultData);
            }

            zmin            = EdgeDetection.GetDataMin(secondResultData);
            zmax            = EdgeDetection.GetDataMax(secondResultData);
            SecondResultMin = zmin;
            SecondResultMax = zmax;
            SecondResultMap = GetMap(secondResultData, zmin, zmax);
        }
Exemple #5
0
        private void EdgeDetect(object parameter)
        {
            int index = Convert.ToInt32(parameter);

            if (index == 0)
            {
                resultData = Tempxdrdata;
            }
            else if (index == 1)
            {
                resultData = Tempydrdata;
            }
            else if (index == 2)
            {
                resultData = Tempzdrdata;
            }
            else if (index == 3)
            {
                resultData = EdgeDetection.Thdr(Tempxdrdata, Tempydrdata);
            }
            else if (index == 4)
            {
                resultData = EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 5)
            {
                resultData = EdgeDetection.Tilt(Tempzdrdata, EdgeDetection.Thdr(Tempxdrdata, Tempydrdata));
            }
            else if (index == 6)
            {
                resultData = EdgeDetection.Theta(EdgeDetection.Thdr(Tempxdrdata, Tempydrdata), EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata));
            }
            else if (index == 7)
            {
                resultData = EdgeDetection.Nstd(Tempxdrdata, Tempydrdata, Tempzdrdata, winSize);
            }
            else if (index == 8)
            {
                resultData = EdgeDetection.Gdo(Tempxdrdata, Tempydrdata, Tempzdrdata, alpha, theta);
            }
            else if (index == 9)
            {
                resultData = EdgeDetection.Ita2(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 10)
            {
                resultData = EdgeDetection.ETA1(Tempxdrdata, Tempydrdata, Tempzdrdata);
            }
            else if (index == 11)
            {
                resultData = EdgeDetection.HFTilt(Tempxdrdata, Tempydrdata, VxxData, VyyData, VxyData);
            }
            else if (index == 12)
            {
                resultData = EdgeDetection.HFTheta(Tempxdrdata, Tempydrdata, VxxData, VyyData, VxyData);
            }
            else if (index == 13)
            {
                var asmData = EdgeDetection.Asm(Tempxdrdata, Tempydrdata, Tempzdrdata);
                double[,] asmZdrData, asmXdrData, asmYdrData;
                if (isFrqDomain)
                {
                    var asmFrqData = FFT.fft_2D(new Complex2D(EdgeDetection.MinCurveExpand(asmData)));
                    asmZdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Zdrf(asmFrqData)).GetRe());
                    asmYdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Ydrf(asmFrqData)).GetRe());
                    asmXdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Xdrf(asmFrqData)).GetRe());
                }
                else
                {
                    asmZdrData = EdgeDetection.Zdr(asmData);
                    asmYdrData = EdgeDetection.Ydr(asmData);
                    asmXdrData = EdgeDetection.Xdr(asmData);
                }
                var asmThdrData = EdgeDetection.Thdr(asmXdrData, asmYdrData);
                resultData = EdgeDetection.Tilt(asmZdrData, asmThdrData);
            }
            else if (index == 14)
            {
                var tiltData = EdgeDetection.Tilt(Tempzdrdata, EdgeDetection.Thdr(Tempxdrdata, Tempydrdata));
                double[,] tiltXdrData, tiltYdrData;
                if (isFrqDomain)
                {
                    var tiltFrqData = FFT.fft_2D(new Complex2D(EdgeDetection.MinCurveExpand(tiltData)));
                    tiltYdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Ydrf(tiltFrqData)).GetRe());
                    tiltXdrData = EdgeDetection.ExpandRestore(FFT.idft_2D(EdgeDetection.Xdrf(tiltFrqData)).GetRe());
                }
                else
                {
                    tiltYdrData = EdgeDetection.Ydr(tiltData);
                    tiltXdrData = EdgeDetection.Xdr(tiltData);
                }

                resultData = EdgeDetection.Thdr(tiltXdrData, tiltYdrData);
            }
            else if (index == 15)
            {
                resultData = EdgeDetection.GuassNoise(anomalyData);
            }
            else if (index == 16)
            {
                resultData = EdgeDetection.Idct(EdgeDetection.Zdrf(EdgeDetection.Dct(anomalyData, false)));
            }

            var zmin = EdgeDetection.GetDataMin(resultData);
            var zmax = EdgeDetection.GetDataMax(resultData);

            ResultMin = zmin;
            ResultMax = zmax;
            ResultMap = GetMap(resultData, zmin, zmax);
        }