public Bitmap2D scaleBitmap2DToRestrictedLineSegment(Bitmap2D bitmap2DToScale, LineSegment lineSegment, Point one, Point two) { //Given a line segment, that has already been restricted to the region rectangle given the 2 points one, and two //scale / padd the image given the fact that the original line might have partially been out of the bounds of the rectangle. return null; }
public Bitmap2D generateBitmap2DCrossSection(List<Point> pointList) { long width = pointList.Count; // perhaps reuse some sections based on size later long height = bitmapDepth; Bitmap2D crossSection = new Bitmap2D(width, height, pixelFormat);//created bitmap 2d containing the same pixel format as the 3d bitmap creating it int x = 0;//x value of pixel columns in the bitmap2d foreach (Point currentPoint in pointList) { //Copy column data directly to the bitmap for (int k = 0; k < bitmapDepth; k++) { //for each pixel in the column copy it into the 2d bitmap //take pixels from the column designated by the point from the pointlist, and the loop variable depth //place it at x,k (where x varies from 0..width of the bitmap (currently every point creates one column in the corresponding 2d image)) crossSection.setPixel(x, k, getPixelAsColor((int)currentPoint.x, (int)currentPoint.y, k)); } x++; } return crossSection; }
public Bitmap2D generate2DCrossSection(Point one, Point two) { //Points are lat longs(or whatever unit you want, as long as you setup the origin of this array region properly/accordingly) //convert them to be relative to the data bitmap3d, which has latlong bounds (rect width/ height can have any unit) one = convertPointToBeRelativeToThisRegion(one); two = convertPointToBeRelativeToThisRegion(two); if (one.x != two.x || one.y != two.y) { LineSegment lineSegment = ArraySpaceUtilities.restrictLineToArraySpace(one, two, numxregions, numyregions); if (lineSegment == null) { //The line doesnt intersect the rectangular data region return null; } //There exists SOME line segment that is within the region, get an image using it, and offset it based on how far it is from the given points //IE the cross section might need to be centered in some way, and padded with pixels //This sets the orientation of the two points up such that the point list makes sense as it flips how vertical points are added //Point one should be left ipad, point 2 = right coordinateList = ArraySpaceUtilities.getArrayIndiciesMarkedByLine(lineSegment, numxregions, numyregions); } else { //The parameters given indicate one point, not a line was passed in, thus only add one point for getting a column coordinateList = new List<Point>(); coordinateList.Add(new Point((int)one.x, (int)one.y)); } coordlistcreated = true; if (one.x > two.x) coordinateList.Reverse(); bitmap2DCrossSection = bitmap3D.generateBitmap2DCrossSection(coordinateList); //bitmap2DCrossSection = scaleBitmap2DToRestrictedLineSegment(bitmap2DCrossSection, lineSegment, one,two); return bitmap2DCrossSection; }
void imageLeft_MouseDown(object sender, MouseButtonEventArgs e) { if (!mouseonedown) { recreateGrid(); imagepointone = new SeismicUtilities.Point(e.GetPosition(imageLeft).X, arraySpaceImageHeight - e.GetPosition(imageLeft).Y); screenpointone = new SeismicUtilities.Point(e.GetPosition(this).X, arraySpaceImageHeight - e.GetPosition(this).Y); mouseonedown = true; Line.Visibility = Visibility.Hidden; } else { imagepointtwo = new SeismicUtilities.Point(e.GetPosition(imageLeft).X, arraySpaceImageHeight - e.GetPosition(imageLeft).Y); screenpointtwo = new SeismicUtilities.Point(e.GetPosition(this).X, arraySpaceImageHeight - e.GetPosition(this).Y); mouseonedown = false; //Draw line Line.X1 = screenpointone.x; Line.X2 = screenpointtwo.x; Line.Y1 = arraySpaceImageHeight - screenpointone.y; Line.Y2 = arraySpaceImageHeight - screenpointtwo.y; crossSectionBitmap2D = SeismicServiceClient.GetSeismicCrossSection(imagepointone.x, imagepointone.y, imagepointtwo.x, imagepointtwo.y); ///crossSectionBitmap2D = SCSG.generate2DCrossSection(imagepointone, imagepointtwo);//bitmap3D.generateBitmap2DCrossSection(coordinates); if (crossSectionBitmap2D != null) { //DisplayiLneOnPixelGrid(SCSG.getCoordList()); DisplayLineOnPixelGrid(SeismicServiceClient.GetSeismicCoordinatesList(), numxregions, numyregions); redrawRightImage(); Line.Visibility = Visibility.Visible; } //imageLeft.Visibility = Visibility.Hidden; } }