# UnsharpLength and Enhancement

The DicomImage.UnsharpLength and DicomImage.UnsharpEnhancement parameters are documented in the help file. Basically, the UnsharpLength defines the size of the area (in image pixels) over which the enhancement is performed. Odd number is expected for UnsharpLength as it defines the area around the center pixel, which is then compared to those pixels around it to see if it should be enhanced up or down. Enhancement defines how much the difference should be increased/decreased.

**Example 1**:

If the pixels are as follows:

1 1 1 1 1

1 3 3 3 1

1 3 6 3 1

1 3 3 3 1

1 1 1 1 1

If UnsharpLength is 3 and UnsharpEnhancement is 0.5 then the 6 value is compared to the 3X3 area around it (all 3s).

First of all, we calculate the Predicted value, which is the average value of that area:

- PredictedPixelValue = (3 x 9)/9 = 3

Then we use this formula to get the the new pixel value after enhancement:

- NewPixelValue = OriginalPixelValue + Enhancement x (OriginalPixelValue - PredictedPixelValue)

This gives us 6 + 0.5x(6 - 3) = **7.5**

**Example 2**:

The same pixels as shown above. If UnsharpLength is 5 and UnsharpEnhancement is 0.5 then we get the following values:

PredictedPixelValue = (16x1 + 8x3)/24 = 1 2/3

NewPixelValue = 6 + 0.5x(6 - 5/3) = **8 1/6**