Search code examples
c#image-processingdicomimagingfo-dicom

Window width and Center and Hounsfield units


I am currently adjusting the brightness and contrast of a grayscale image using fo-dicom.

Loading the image:

    _dicomFile = DicomFile.Open(GetImageFileName());
    _dicomImage = new DicomImage(_dicomFile.Dataset);
    WindowLevel = _dicomImage.WindowCenter;
    WindowWidth = _dicomImage.WindowWidth;
    var grayScaleOptions = GrayscaleRenderOptions.FromBitRange(_dicomFile.Dataset);
    Depth = grayScaleOptions.BitDepth.BitsAllocated;

    DisplayedImage = _dicomImage.RenderImage().As<WriteableBitmap>();

On mouse move, I am adjusting the brightness and contrast

 public void OnMouseMove(object sender, MouseCaptureArgs e)
    {
       //...
        _dicomImage.WindowWidth += e.X - _lastXPos;
        _dicomImage.WindowCenter += e.Y - _lastYPos;
        _dicomImage.UseVOILUT = false;

        _lastXPos = e.X;
        _lastYPos = e.Y;
        DisplayedImage = _dicomImage.RenderImage().As<WriteableBitmap>();
    }

Everything is working as expected. I am little confused where Hounsfield values come into picture. I know about how HU is calculated based on slope and intercept.

I have checked the fo-dicom code and did not find any references to HU.

If I display the WW and WC values that I am calculating here on the image, it won't be the HU values that user expects to see?


Solution

  • Using Rescale Slope (0028,1053) and Rescale Intercept (0028,1052) for applying a linear transformation (AKA the "Modality LUT" - which may also be non-linear by using other attributes) to the pixel values in order to map them to "some scale" is a generic concept in DICOM - not limited to CT images where you have hounsfield units.

    It is probably for this reason that FO-DICOM does not explicitly mention "HU". The header attribute Rescale Type (0028,1054) tells you the scale to which unit the modality LUT transforms the pixel values. As you can see in PS3.3, C.11.1.1.2 there are other possible units that may apply to other image types. So it is all generic and self-describing and no need to consider HU differently from other scales.

    So the Windowing always applies to mapped values (= the output of the Modality LUT) regardless of which units that refers to. For CT images, the CT Image Module puts the requirement that you can assume the Rescale Type to be HU unless a different unit is explicitly given.