Ivan NovikovIvan
Novikov

Windowing a CT Slice

A CT slice stores about four thousand distinct values per voxel — twelve bits of Hounsfield units, running from roughly minus one thousand for air to well past a thousand for dense bone. A monitor shows two hundred and fifty six shades of grey, and an eye reliably separates rather fewer than that. Something has to be thrown away. Windowing is the decision about what.

The rule is a straight ramp with two numbers. Level is where the ramp sits, width is how wide it is. Everything below the ramp becomes flat black, everything above becomes flat white, and the whole grey range is spent on what falls inside.

01WINDOW AND LEVEL
-1024+2048 HU2550WINDOW 400 / LEVEL 40OUTSIDE THE WINDOW EVERYTHING IS FLAT BLACK OR FLAT WHITE
Level 40, width 400. Every value outside that band is clipped, deliberately.

That sounds destructive until you look at where the values actually live. Air sits near minus one thousand, fat around minus a hundred, water at zero by definition, soft tissue in a tight band just above it, bone far off to the right. The interesting organs occupy a couple of hundred units in the middle of a four thousand unit range.

02WHERE THE VOXELS ARE
AIRSOFT TISSUEBONEHOW MANY VOXELS SIT AT EACH DENSITY · ONE SLICE
One slice, counted by density. A soft-tissue window spends every available shade on the marked band.

So a soft-tissue window is not a compromise. It is the correct allocation for the question being asked. A bone window is the correct allocation for a different question, and it is the same stored voxels rendered again — nothing is reloaded, nothing is recomputed, nothing about the file changed.

03ONE SLICE, TWO QUESTIONS
SOFT TISSUE · 400/40BONE · 2000/575IDENTICAL STORED VOXELS · TWO WINDOWS · TWO ORGANS
Identical stored data. The left window cannot show cortical detail; the right one cannot show the organs.

This is why a viewer keeps the original sixteen-bit data in the texture and applies the window in a shader. Changing the window becomes two uniforms and a redraw, which is why dragging with the right mouse button feels instant while loading the series did not.

It is also why a screenshot of a scan is a quote rather than the source. It carries one window, chosen by whoever took it, with everything outside it already gone.

2.8.1/279be29