Medical image "Window-Level" algorithm

xiaoxiao2021-04-10  535

One problem with image display and printing is: whether the brightness and contrast of the image can fully highlight key parts. The example referred to herein has a soft tissue, bone, brain tissue, lung, abdomen, etc. in CT.

Technical issues: Display often only 8-bit, but data is from 12 to 16-bits. If the data of the Min and Max between the data is converted to 8-bit 0-255, the process is a loss of transition, and the image is often outstanding is some noise.

For these issues, researchers first propose some requirements and then propose some algorithms based on these requirements. These algorithms are now very mature.

Requirement 1: Take advantage of 0-255 display valid domain requirements 2: Minimize the loss requirements of value domain compression: I can't lose organization part

Algorithm analysis: a. 16-bit to 8-bit direct conversion:

Computeminmax (Pixel_Val, Min, Max); // First, the maximum and minimum values ​​of the image are (i = 0; i

This algorithm must have, which is very effective for many types of images: such as 8-bit images, MRI, ECT, CR, etc..

B. WINDOW-Leveling Algorithm: W / L is specifically designed for CT. The principle is simple: the density of different tissues in the CT image (hounsfield unit) is in a fixed value domain, which is not related to the specific device and imaging software. Therefore, when you want to watch the skull, we only need to convert the values ​​of the skull to 0-255.

CT W / L does not speak MIN and MAX in the skull value, and MAX-min (ie Window_Width) and (Max Min) / 2 (ie Window_Center) are said.

We can also use the original formula, just MIN and MAX algorithms are different.

// First, the maximum and minimum minimum minimum minimum of the image is = (2 * window_center - window_width) / 2.0 0.5; max = (2 * window_center window_width) / 2.0 0.5; for (i = 0; i

Note that the CT image must be converted to the hounsfield value and do Window-Level. This conversion includes turn redundant high bits into 0 (clipping), and uses Recale Slope and Rescale Intercept to do unit conversion.

Hu [i] = pixel_val [i] * rescale_slope rescale_intercept

C. Nonlinear conversion

I just said that the value between MIN and MAX is transformed between 0-255. If max - min comes out is a big value, for example, 25500, then, each of the original density is compressed into a display grayscale. Such a loss may be large.

Because the human eye is non-linear, nonlinear conversion can solve some problems. There are two common algorithms with LOG and GAMMA. Gamma is better to adjust the Gamma value, so it is much more used.

For (i = 0; i

Add a few points:

o Pay attention to the processing of values ​​outside the effective grayscale field when doing any conversion. It is best to use int instead of unsigned char to turn into the matrix to avoid Overflow and Underflow.

Double Dfactor = 255.0 / (double - min); int Npixelval;

For (i = 0; i

Npixelval = (int) ((pixel_val [i] - min) * DFACTOR);

IF (npixelval <0) DISP_PIXEL_VAL [I] = 0; Else IF (Npixelval> 255) DISP_PEL_VAL [I] = 255; Else Disp_pixel_val [i] = npixelval;

}

o Attention to the processing of the original data outside 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

IF (Pixel_Val [I]> max) {DISP_PIXEL_VAL [I] = 255; Continue;}

Npixelval = (int) ((pixel_val [i] - min) * DFACTOR);

IF (npixelval <0) DISP_PIXEL_VAL [I] = 0; Else IF (Npixelval> 255) DISP_PEL_VAL [I] = 255; Else Disp_pixel_val [i] = npixelval;

}

转载请注明原文地址:https://www.9cbs.com/read-133437.html

New Post(0)