# C.11.2.1.2 Window center and window width

Window Center (0028,1050) and Window Width (0028,1051) specify a linear conversion from stored pixel values (after any Modality LUT or Rescale Slope and Intercept specified in the IOD have been applied) to values to be displayed. Window Center contains the input value that is the center of the window. Window Width contains the width of the window.

Note: The terms “window center” and “window width” are not consistently used in practice, nor were they defined in previous versions of the standard. The definitions here are presented for the purpose of defining consistent meanings for identity and threshold transformations while preserving the common practice of using integral values for center and width.

Window Width (0028,1051) shall always be greater than or equal to 1.

When Window Width (0028,1051) is greater than 1, these Attributes select the range of input values that are to be mapped to the full range of the displayed output.

When Window Width (0028,1051) is equal to 1, they specify a threshold below which input values will be displayed as the minimum output value.

Note: Whether the minimum output value is rendered as black or white may depend on the value of Photometric Interpretation (0028,0004) or the presence of a Presentation LUT Module.

These Attributes are applied according to the following pseudo-code, where x is the input value, y is an output value with a range from y min to y max , c is Window Center (0028,1050) and w is Window Width (0028,1051):

if (x <= c - 0.5 - (w-1)/2), then y = y min

else if (x > c - 0.5 + (w-1)/2), then y = y max ,

else y = ((x - (c - 0.5)) / (w-1) + 0.5) * (y max - y min )+ y min

Notes: 1. For the purpose of this definition, a floating point calculation without integer truncation is assumed, though the manner of implementation may vary as long as the result is the same.

2. The pseudo-code function computes a continuous value over the output range without any discontinuity at the boundaries. The value of 0 for w is expressly forbidden, and the value of 1 for w does not cause division by zero, since the continuous segment of the function will never be reached for that case.

3. For example, for an output range 0 to 255:

c=2048, w=4096 becomes:

if (x <= 0) then y = 0

else if (x > 4095) then y = 255

else y = ((x - 2047.5) / 4095 + 0.5) * (255-0) + 0

c=2048, w=1 becomes:

if (x <= 2047.5) then y = 0

else if (x > 2047.5) then y = 255

else /* not reached */

c=0, w=100 becomes:

if (x <= -50) then y = 0

else if (x > 49) then y = 255

else y = ((x + 0.5) / 99 + 0.5) * (255-0) + 0

c=0, w=1 becomes:

if (x <= -0.5) then y = 0

else if (x > -0.5) then y = 255

else /* not reached */

4. A Window Center of 2 n-1 and a Window Width of 2 n selects the range of input values from 0 to 2 n -1. This represents an identity VOI LUT transformation in the case where no Modality LUT is specified and the stored pixel data are n bit unsigned integers.

5. A Window Width of 1 is typically used to represent a "threshold" operation in which those integer input values less than the Window Center are represented as the minimum displayed value and those greater than or equal to the Window Center are represented as the maximum displayed value. A Window Width of 2 will have the same result for integral input values.

6. The application of Window Center (0028,1050) and Window Width (0028,1051) may select a signed input range. There is no implication that this signed input range is clipped to zero.

7. The selected input range may exceed the actual range of the input values, thus effectively “compressing” the contrast range of the displayed data into a narrower band of the available contrast range, and “flattening” the appearance. There are no limits to the maximum value of the window width, or to the minimum or maximum value of window level, both of which may exceed the actual or possible range of input values.

8. Input values "below" the window are displayed as the minimum output value and input values "above" the window are displayed as the maximum output value. This is the common usage of the window operation in medical imaging. There is no provision for an alternative approach in which all values "outside" the window are displayed as the minimum output value.

9. The output of the Window Center/Width or VOI LUT transformation is either implicitly scaled to the full range of the display device if there is no succeeding transformation defined, or implicitly scaled to the full input range of the succeeding transformation step (such as the Presentation LUT), if present. See C.11.6.1.

10. Fractional values of Window Center and Window Width are permitted (since the VR of these Attributes is Decimal String), and though they are not often encountered, applications should be prepared to accept them.

These Attributes shall be used only for Images with Photometric Interpretation (0028,0004) values of MONOCHROME1 and MONOCHROME2. They have no meaning for other Images.

If multiple values are present, both Attributes shall have the same number of values and shall be considered as pairs. Multiple values indicate that multiple alternative views may be presented.

If any VOI LUT Table is included by an Image, a Window Width and Window Center or the VOI LUT Table, but not both, may be applied to the Image for display. Inclusion of both indicates that multiple alternative views may be presented.

If multiple items are present in VOI LUT Sequence (0028,3010), only one may be applied to the Image for display. Multiple items indicate that multiple alternative views may be presented.

If the VOI LUT Module is defined in an IOD and if neither a VOI LUT Sequence nor a Window Width and Window Center are present, then the VOI LUT stage of the grayscale pipeline is defined to be an identity transformation.

Notes: 1. This requirement is specified so that IODs that define a particular output space for the grayscale pipeline, such as P-Values, are not in an undefined state when no VOI LUT Sequence or Window Width and Window Center are present.

2. Despite the Type 3 requirement for VOI LUT Sequence and Window Center, implementations that render images are expected to implement and apply these transformations when they are present in the image, unless overridden by the user, a presentation state, or a hanging protocol, and to allow the user to select which transformation to apply when multiple transformations are present.