Adapt window level and width after using vtkImageConvolve

I’ve been able to apply a sharpening filter using vtkImageConvolve, but it seems this operation also alters the windowing scale. I have to use a different WW/WL to achieve the same appearance I have with non-sharpened image data.
Is there a way to normalize the image windowing scale after applying the convolution filter?

The first thing to verify is that your convolution kernel is normalized. If it is, then the only changes in WW/WL will be due to small amounts of overshoot due to the sharpening.

1 Like

Thank you for the reply. I used the “Sharpen 3x3” kernel from Horos:

vtkNew<vtkImageConvolve> convolveFilter;
        convolveFilter->SetInputData([wrapper getImageData]);
double kernel[9] = {-1, 0, -1, 0, 7, 0, -1, 0, -1};

I resolved the issue with WW/WL by multiplying both by 3 when using the sharpening filter; this way I get the same window appearance I have in non-sharpened images. I don’t know if there’s something wrong in my code or if this is an expected behavior.

By the way, what is the expected RAM usage of this operation? I’m applying it on a ~1GB DICOM series and the memory usage increases to ~1.9GB after performing the sharpening. Is this correct?

Normalize the kernel instead of changing the WW/WL. The normalization is easy to do. Just sum all the elements of the kernel, and then divide the elements by this sum:

-1 * 4 + 7 = 3

The kernel after normalization is as follows:

-0.3333333333333333, 0.0, -0.3333333333333333,
 0.0, 2.3333333333333333, 0.0,
-0.3333333333333333, 0.0, -0.3333333333333333

It’s natural for the memory usage to increase, since you will have both the old image and the new image in memory.

1 Like