Detailed explanation of mature window-leveling algorithms for Medical Images

Source: Internet
Author: User

I have always thought that I have understood the adjustment of the window width and window space. But with the application in development, I found that there are still many questions about this part of knowledge, especially in the aspect of Design printing, the previous self-thinking is actually simply simplifying the problem. There is no end to learning. I am very happy to see my progress.

One problem facing image display and printing is whether the brightness and contrast of the image can fully highlight the key part. The examples of the "key part" mentioned here in CT include soft tissue, bone, brain tissue, lung, abdomen, and so on.

 

Technical questions:
The display usually only has 8-bit, and the data has 12-to 16-bits.
If the data between min and max (Dynamic Range) is converted to 8-Bit 0-255, the process is lossy conversion, in addition, the image is often highlighted by noise.

To address these problems, the researchers first put forward some requirements (requirements) and then proposed some algorithms based on these requirements. These algorithms are mature now.

Requirement 1: Make full use of the valid display range between 0 and 255
Requirement 2: minimize the loss caused by value Compression
Requirement 3: do not lose the organization that should be highlighted

Algorithm analysis:
A. Direct conversion from 16-bit to 8-bit:

Computeminmax (pixel_val, Min, max); // calculate the maximum and minimum values of the image.
For (I = 0; I <nnumpixels; I ++)
Disp_pixel_val = (pixel_val-min) * 255.0/(double) (max-min );

This algorithm must be available for many types of images: 8-bit images, MRI, ect, Cr, etc.

B. Window-leveling algorithm:

W/L is specially designed for CT. The principle is simple: the density of different tissue in CT images (in the unit of hounsfield) is in a fixed value range, and it has nothing to do with specific equipment and imaging software. Therefore, when looking at the skull, we only need to convert the value of the skull to 0-255.

Ct w/L does not talk about the min and max of the skull value range, but about max-min (window_width) and (MAX + min)/2 (window_center ).

We can also use the original formula, but the min and Max algorithms are different.

// Calculate the maximum and minimum values of the image.
Min = (2 * window_center-window_width)/2.0 + 0.5;
Max = (2 * window_center + window_width)/2.0 + 0.5;
For (I = 0; I <nnumpixels; I ++)
Disp_pixel_val = (pixel_val-min) * 255.0/(double) (max-min );

Note that the CT image must be converted to the hounsfield value before the window-level operation. This conversion includes converting excess bits to 0 (clipping), and using recale slope and rescale intercept for unit conversion.

Hu = pixel_val * rescale_slope + rescale_intercept

C. Nonlinear Conversion

I just mentioned linear conversion of values between min and Max to 0-255. If max-min is a large value, for example, 25500, the original density of each 100 is compressed into a gray scale. Such a loss may be huge.

Because the gray-scale reaction of human eyes is non-linear, nonlinear conversion can solve some problems. Common algorithms include log and Gamma. Gamma is easier to adjust the GAMMA value, so it is used more.

For (I = 0; I <nnumpixels; I ++)
Disp_pixel_val = 255.0 * POW (pixel_value/(max-min), 1.0/gamma );

D. Valid value range: The window-level of CT has a standard definition. See "Practical CT techniques", by Wladyslaw gedroyc and Sheila Rankin, Springer-Verlag. Most commonly used methods include WW = 400, WL = 40 (many useful parts); ww = 100, WL = 36 (head); ww = 3200, WL = 200 (bone ), and so on.

 

Additional points:

  •  When performing any conversion, pay attention to the processing of values outside the valid gray scale.

 
It is best to use int instead of unsigned char for calculation, and then transfer to the Matrix to avoid overflow and underflow.

Double dfactors = 255.0/(double) (max-min );
Int npixelval;

For (I = 0; I <nnumpixels; I ++)
{

Npixelval = (INT) (pixel_val-min) * dfactor );

If (npixelval <0)
Disp_pixel_val = 0;
Else if (npixelval & gt; 255)
Disp_pixel_val = 255;
Else
Disp_pixel_val = npixelval;

}

  • Note the processing of raw data outside of Min and Max when doing window-level.

Double dfactor, Min, Max;
Int npixelval;

Min = (2 * window_center-window_width)/2.0 + 0.5;
Max = (2 * window_center + window_width)/2.0 + 0.5;
Dfactor = 255.0/(double) (max-min );

For (I = 0; I <nnumpixels; I ++)
{
If (pixel_val <min)
{
Disp_pixel_val = 0;
Continue;
}

If (pixel_val> MAX)
{
Disp_pixel_val = 255;
Continue;
}

Npixelval = (INT) (pixel_val-min) * dfactor );

If (npixelval <0)
Disp_pixel_val = 0;
Else if (npixelval & gt; 255)
Disp_pixel_val = 255;
Else
Disp_pixel_val = npixelval;

}

 

The following content is translated from the book "CT Diagnostics", hoping to help you better understand the wide window.

Window width and Position
CT can identify the density difference between 2000 different gray scales in the human body. However, human eyes can only tell 16 gray-scale degrees. Therefore, the CT value that can be distinguished by human eyes on CT images should be 125 HU (2000/16 ). In other words, the CT value of different tissues in the human body can be recognized by human eyes only when the difference is above 125hu. Human soft tissue CT value changes between 20-50 HU, human eyes cannot recognize. Therefore, segmentation observation is required to reflect the advantages of CT. The observed CT value range is called window width. The central CT value of observation is the window or window center.
(1) The window width refers to the CT value range displayed in the CT image. The organizational structure within this CT value range is divided into 16 gray scales based on its density from white to black for observation and comparison. For example, if the window width is set to 100 Hu, the human eye can distinguish the CT value from 100/16 to 6. 25 Hu, that is, the difference between the CT values of the two tissues is 6. more than 25hu can be recognized by human eyes. Therefore, the width and width of the window directly affect the image definition and contrast. If a narrow window width is used, the displayed CT value range is small, each gray scale represents a small CT value range, and the contrast is strong. It is suitable for observing close tissue structures (such as brain tissue ). If the wide window width is used, the displayed CT value range is large, and each gray scale represents a large CT value range, the image contrast is poor, but the density is even, suitable for observing structures with high density differences (such as bone and soft tissue ).
(2) The window center refers to the mean value or the center value within the window width range. For example, for a CT image, the window width is Hu, and the window position is 0 HU. The window is centered on the window position (0 HU), and the window position is + 50 HU, and the window width is-50 HU, any organization within the 100HU range can be displayed and recognized by human eyes. All the organizations larger than + 50hu are white; all the organizations of the kid-50hu are black, and their density differences cannot be displayed. The human eye can only recognize CT values within the range of 50 HU, and the CT value range of each gray scale is 100/16 = Hu.
In principle, the window position should be equal to or close to the CT value to be observed; the window width should reflect the CT value change range of the tissue or lesion.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.