1

What is the difference between applying the Default Linear function for windowing to get the pixel value to display like so

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 ymin to ymax, c is Window Center (0028,1050) and w is Window Width (0028,1051):

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

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

else y = ((x - (c - 0.5)) / (w-1) + 0.5) * (ymax- ymin) + ymin

and this other approach that many people on the internet also speak off, like so?

lowest_visible_value = window_center - window_width / 2
highest_visible_value = window_center + window_width / 2
E_net4
  • 27,810
  • 13
  • 101
  • 139
Sergio Solorzano
  • 476
  • 9
  • 29

2 Answers2

1

The results are very similar and only in rare cases you would visually note a difference. Obviously, the "official" formula works in floating point space and handles rounding of fractions of pixel values more precisely than the simplified version.

Markus Sabin
  • 3,916
  • 14
  • 32
0

The difference is: the first function is defined in DICOM standard and therefore should be used always!

The sites you linked explained the windowing and gave you a short formula, how to estimate the highest and lowest pixel value that are scaled with the window center and window width parameter. They are not used to calculate the actual pixel value. As you noticed, those short formulas do not contain a input value X.

Maybe you will find some sites on the internet, where they do not use the interpolation as defined in DICOM standard, but they use something like that: (I also have seen sometimes)

y = 128 + 255 * (x - window_center) / window_width

And in fact you will hardly find a difference in the resulting image. But there may be some cornercases where this formula results in different images. And the officially defined is not so hard to implement, so you should use that.

To complete that: DICOM also defined the VOI LUT Function LINEAR_EXACT, that is defined that way:

if (x <= c - w/2), then y = ymin
else if (x > c + w/2), then y = ymax
else y = ((x - c) / w + 0.5) * (ymax- ymin) + ymin

So doing the simplified linear interpolation is also defined in DICOM-Standard. But not as the default function, but only if it is explicitly configured in the DICOM file.

gofal3
  • 1,213
  • 10
  • 16