public MSPointSet3D SubPointSetExtract(RegionSize SR) { MSPointSet3D tempPointSet = new MSPointSet3D(); //foreach (MSPoint3D D in MyCurrentPointSet3D.) for (int i = 0; i < RawDataPointSet3D.Count; i++) { if (RawDataPointSet3D._x[i] >= SR.LeftBound && RawDataPointSet3D._x[i] <= SR.RightBound && RawDataPointSet3D._y[i] <= SR.TopBound && RawDataPointSet3D._y[i] >= SR.BottomBound) { tempPointSet.Add(RawDataPointSet3D._x[i], RawDataPointSet3D._y[i], RawDataPointSet3D.Z(i)); } } return(tempPointSet); }
public MSPointSet3D BSpline3DofPepImage(MSPointSet3D mspointset, RegionSize PaintRegion) { MSPointSet3D interpolatedPointSet3D = new MSPointSet3D(); RegionSize pointSetRegion = new RegionSize(mspointset.MinX, mspointset.MaxX, mspointset.MaxY, mspointset.MinY); if (pointSetRegion.Width * pointSetRegion.Height * PaintRegion.Width * PaintRegion.Height == 0) { return mspointset; } float[,] Data; Data = MSpointSet3DToArray(mspointset, PaintRegion); for (int i = 0; i < (int)PaintRegion.Width + 1; i++) { MSPointSet pointset2D = new MSPointSet(); float MaxIntensity = -1; bool empty = true; for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] != -1) { empty = false; if (Data[i, j] > MaxIntensity) { MaxIntensity = Data[i, j]; } } } if (empty == false) { for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] == -1) { Data[i, j] = 0; } } } } for (int i = 0; i < (int)PaintRegion.Height + 1; i++) { MSPointSet pointset2D = new MSPointSet(); float MaxIntensity = 0; for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] > MaxIntensity) { MaxIntensity = Data[j, i]; } } if (MaxIntensity > 0/*mspointset.MaxZ/1*/) { for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] != -1) { pointset2D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, j), Data[j, i]); } } pointset2D = BSpline2D(pointset2D, pointSetRegion, PaintRegion, "horizontal"); for (int x = 0; x < pointset2D.Count; x++) { if (Data[(int)Math.Round((CoordinateTrans.TimeToX(pointSetRegion, PaintRegion, pointset2D.X(x)))), i] == -1) { Data[(int)Math.Round((CoordinateTrans.TimeToX(pointSetRegion, PaintRegion, pointset2D.X(x)))), i] = pointset2D.Y(x); } } } else { for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] == -1) { Data[j, i] = 0; } } } } Data = NoiseFiltering(Data, (int)PaintRegion.Height + 1, (int)PaintRegion.Width + 1); for (int i = 0; i < (int)PaintRegion.Width + 1; i++) { for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] != -1) { interpolatedPointSet3D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, i), CoordinateTrans.YToMass(PaintRegion, pointSetRegion, j), Data[i, j]); } else { interpolatedPointSet3D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, i), CoordinateTrans.YToMass(PaintRegion, pointSetRegion, j), 0); } } } return interpolatedPointSet3D; }
public MSPointSet3D SubPointSetExtract(RegionSize SR) { MSPointSet3D tempPointSet = new MSPointSet3D(); //foreach (MSPoint3D D in MyCurrentPointSet3D.) for (int i = 0; i < RawDataPointSet3D.Count; i++) { if (RawDataPointSet3D._x[i] >= SR.LeftBound && RawDataPointSet3D._x[i] <= SR.RightBound && RawDataPointSet3D._y[i] <= SR.TopBound && RawDataPointSet3D._y[i] >= SR.BottomBound) { tempPointSet.Add(RawDataPointSet3D._x[i], RawDataPointSet3D._y[i], RawDataPointSet3D.Z(i)); } } return tempPointSet; }
public MSPointSet3D BSpline3DofPepImage(MSPointSet3D mspointset, RegionSize PaintRegion) { MSPointSet3D interpolatedPointSet3D = new MSPointSet3D(); RegionSize pointSetRegion = new RegionSize(mspointset.MinX, mspointset.MaxX, mspointset.MaxY, mspointset.MinY); if (pointSetRegion.Width * pointSetRegion.Height * PaintRegion.Width * PaintRegion.Height == 0) { return(mspointset); } float[,] Data; Data = MSpointSet3DToArray(mspointset, PaintRegion); for (int i = 0; i < (int)PaintRegion.Width + 1; i++) { MSPointSet pointset2D = new MSPointSet(); float MaxIntensity = -1; bool empty = true; for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] != -1) { empty = false; if (Data[i, j] > MaxIntensity) { MaxIntensity = Data[i, j]; } } } if (empty == false) { for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] == -1) { Data[i, j] = 0; } } } } for (int i = 0; i < (int)PaintRegion.Height + 1; i++) { MSPointSet pointset2D = new MSPointSet(); float MaxIntensity = 0; for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] > MaxIntensity) { MaxIntensity = Data[j, i]; } } if (MaxIntensity > 0 /*mspointset.MaxZ/1*/) { for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] != -1) { pointset2D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, j), Data[j, i]); } } pointset2D = BSpline2D(pointset2D, pointSetRegion, PaintRegion, "horizontal"); for (int x = 0; x < pointset2D.Count; x++) { if (Data[(int)Math.Round((CoordinateTrans.TimeToX(pointSetRegion, PaintRegion, pointset2D.X(x)))), i] == -1) { Data[(int)Math.Round((CoordinateTrans.TimeToX(pointSetRegion, PaintRegion, pointset2D.X(x)))), i] = pointset2D.Y(x); } } } else { for (int j = 0; j < (int)PaintRegion.Width + 1; j++) { if (Data[j, i] == -1) { Data[j, i] = 0; } } } } Data = NoiseFiltering(Data, (int)PaintRegion.Height + 1, (int)PaintRegion.Width + 1); for (int i = 0; i < (int)PaintRegion.Width + 1; i++) { for (int j = 0; j < (int)PaintRegion.Height + 1; j++) { if (Data[i, j] != -1) { interpolatedPointSet3D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, i), CoordinateTrans.YToMass(PaintRegion, pointSetRegion, j), Data[i, j]); } else { interpolatedPointSet3D.Add(CoordinateTrans.XToTime(PaintRegion, pointSetRegion, i), CoordinateTrans.YToMass(PaintRegion, pointSetRegion, j), 0); } } } return(interpolatedPointSet3D); }