DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / SpacingInViewer Method
The Area for which the spacing should be calculated
The viewer for which the spacing applies
Example

In This Topic
    SpacingInViewer Method
    In This Topic
    This method returns the Pixel Spacing within the region specified by Area, in a particular viewer
    Syntax
    'Declaration
     
    
    Public Overridable Function SpacingInViewer( _
       ByVal Area As System.Drawing.Rectangle, _
       ByVal Viewer As DicomViewer _
    ) As System.Drawing.SizeF
    public virtual System.Drawing.SizeF SpacingInViewer( 
       System.Drawing.Rectangle Area,
       DicomViewer Viewer
    )

    Parameters

    Area
    The Area for which the spacing should be calculated
    Viewer
    The viewer for which the spacing applies

    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.

    Note that for non-3D images, this returns exactly the same value as Spacing(Rectangle), but that 3D images have scaling dependent on the viewer size, as autoscaling is used for such images.

    Example
    DicomImage image = new DicomImage("yuour_dicom_image.dcm");
    var imageWidth = image.Size.Width;
    var imageHeight = image.Size.Height;
    var spaceViewer = image.SpacingInViewer(new Rectangle(0, 0, imageWidth, imageHeight), Viewer); // Example value {Width = 0.714 Height = 0.714} mm
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also