private double[] getImageData(List <SpotInformation> spots) { //配列作成 var fdsg = FormDiffractionSimulator.FormDiffractionSimulatorGeometry; //Src (mm)をピクセル座標に変換 var convSrcToPixelInt = new Func <PointD, Point>(p => new Point((int)(p.X / fdsg.DetectorPixelSize + fdsg.FootX + 0.5), (int)(p.Y / fdsg.DetectorPixelSize + fdsg.FootY + 0.5))); //Pixel座標をSrc座標に変換 var convPixelToSrc = new Func <int, int, PointD>((x, y) => new PointD((x - fdsg.FootX) * fdsg.DetectorPixelSize, (y - fdsg.FootY) * fdsg.DetectorPixelSize)); int width = fdsg.DetectorWidth, height = fdsg.DetectorHeight; double[] data = new double[width * height]; if (spots.Count == 0) { return(data); } var sigma = spots[0].Sigma; int range = 2;// (int)(s.Sigma * / fdsg.DetectorPixelSize + 0.5);//時間がかかりすぎる。どうするか。。。 int range2 = range * range; var coeff1 = 1 / 2 / sigma / sigma; foreach (var s in spots) { var center = new PointD(s.X, s.Y);//ピクセル位置 var centerPix = convSrcToPixelInt(center); int centerX = centerPix.X, centerY = centerPix.Y; int yMin = Math.Max(0, centerY - range), yMax = Math.Min(height, centerY + range + 1); int xMin = Math.Max(0, centerX - range), xMax = Math.Min(width, centerX + range + 1); for (int y = yMin; y < yMax; y++) { for (int x = xMin; x < xMax; x++) { if ((x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) <= range2) { double dev2 = (center - convPixelToSrc(x, y)).Length2; data[y * width + x] += s.Intensity * Math.Exp(-dev2 * coeff1); } } } } data = ImageProcess.GaussianBlurFast(data, width, sigma / fdsg.DetectorPixelSize / 2);//半値幅なので、ちゃんと計算しなければ return(data); }