DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / Spacing Method / Spacing(Rectangle) Method
The Area for which the spacing should be calculated
Example

In This Topic
    Spacing(Rectangle) Method
    In This Topic
    This method returns the Pixel Spacing within the region specified by Area
    Syntax
    'Declaration
     
    
    Public Overloads Function Spacing( _
       ByVal Area As System.Drawing.Rectangle _
    ) As System.Drawing.SizeF
    public System.Drawing.SizeF Spacing( 
       System.Drawing.Rectangle Area
    )

    Parameters

    Area
    The Area for which the spacing should be calculated

    Return Value

    The pixel spacing of the requested area
    Remarks
    This method returns the Pixel Spacing within a Region of the DicomImage. Note, one Image may have multiple regions with different pixel spacing values, so this method may return different values for different inputs.
    Example
    DicomImage image = new DicomImage("your_dicom_image.dcm");
    var imageWidth = image.Size.Width;
    var imageHeight = image.Size.Height;
    // Pixel spacing of whole image
    var spaceSize = image.Spacing(new Rectangle(0, 0, imageWidth, imageHeight)); // Example result {Width = 0.684 Height = 0.684} mm
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also