Calculate windowing width and level from Image pixel data

Calculating windowing width and level from Image pixel data can be done via accessing the raw pixel data and applying your own algorithm or via the DicomObjects method SetDefaultWindows of the DicomImage object.

How DicomObjects handles Width and Level values

The Width COM/.NET and Level COM/.NET properties of an image are unusual, in that they are both stored as a part of the image, and are also transient DicomImage properties, regularly adjusted by users. This page explains the relationship between the persistent and transient values.