DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / SetDefaultWindows() Method
Example

In This Topic
    SetDefaultWindows() Method
    In This Topic
    Recalculates the default windows used by DicomObjects as if the image had just been loaded
    Syntax
    'Declaration
     
    
    Public Sub SetDefaultWindows() 
    public void SetDefaultWindows()
    Remarks
    Where possible, DicomObjects sets the initial values of Width and Level using attributes (0028,1050) & (0028,1051) in the file itself, but where these are not present, it calculates the values by measuring the range of pixel values. The values may of course be subsequently changed, and this method is therefore useful either to reset to initial values, or to calculate suitable "guess" values when new images are created, or when the pixel data itself is changed.
    Example
    DicomImage image = new DicomImage("your_dicom_image.dcm");
    image.SetDefaultWindows();
                        
    // Check the new windows values
    var width = image.Width; // Example result: 350
    var level = image.Level; // Example result: 35
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also