Correcting shaded illumination on medical image.

      Comments Off on Correcting shaded illumination on medical image.

By using CLAHE algorithm, there’s some problem occurs by object shapes like this:

Each edge side of object going too darken by window leveling. It is defecting issue of CLAHE. So I tried to make it corrected with shading correction.

Here is source raw image, 14bit gray.

First, I need make a background mask to overriding changed level after CLAHE.

It can generate simply by using my librawprocessor. Then I applied CLAHE, 10×10, 30.0f.

Shadowed or shaded areas occurs after applying CLAHE, it must be corrected. So I made shaded map with my fast resize engine. Down scale to 10% of original image size with Bi-Linear filter, then up scale again with B-Spline filter with inverse.

It is much effective than Gaussian blur. Very fast but similar to Gaussian blurred. almost realtime in 3000×3000 array with floating point  levels in AVX and OpenMP optimization.

Now I am just add masked shade map level with exponential to original image.

{
    if ( ( src == NULL ) || ( smap == NULL ) )
        return;

    if ( src->Width() != smap->Width() )
        return;

    if ( src->Height() != smap->Height() )
        return;

    float* datasrc = src->Data();
    float* datamap = smap->Data();

    #pragma omp parellel for
    for( unsigned cnt=0; cnt< src->Size(); cnt++ )
    {
        float diffs = datamap[ cnt ];

        if ( diffs > 0.0f )
        {
            datasrc[ cnt ] += exp( diffs );
        }
    }

Result is :

Shaded object areas seems to enhanced than before. So I continued to applying background mask.

Ok, then I made it to window leveled.

Each edge sides are not seems to much shaded than before. It should be better than applying single CLAHE. I will continue to write more effective image processing with CLAHE.