ClearCanvas.ImageViewer.RoiGraphics.Roi.GetBoundingBoxRounded C# (CSharp) Method

GetBoundingBoxRounded() public method

Returns a bounding box that has been rounded to the nearest whole pixel(s).
Uses RectangleUtilities.RoundInflate to ensure the bounding box returned will encompass every pixel that is inside the ROI.
public GetBoundingBoxRounded ( bool constrainToImage ) : Rectangle
constrainToImage bool Whether or not the returned rectangle should also be constrained to the image bounds.
return System.Drawing.Rectangle
		public Rectangle GetBoundingBoxRounded(bool constrainToImage)
		{
			Rectangle bounds = RectangleUtilities.RoundInflate(BoundingBox);
			if (constrainToImage)
			{
				bounds.Intersect(new Rectangle(0, 0, ImageSize.Width - 1, ImageSize.Height - 1));
			}

			return bounds;
		}