Intensity transformation with Sigmoid filter

I have lung CT data and I want all the scans to be in the range (-1024 to 3000). I’m using the Sigmoid filter, my first question is how to choose alpha and beta parameters?

I’m using SimpleITK, I wrote this script to perform the transformation

sigmoid = sitk.SigmoidImageFilter
sigmoid.SetOutputMinimum = -1024
sigmoid.SetOutputMaximum = 3000
sigmoid.SetAlpha = alpha
sigmoid.SetBeta = beta
sigmoidOutput = sigmoid.Execute(img)

I got this error (TypeError: Execute() missing 1 required positional argument: ‘image1’),
I’m passing the image as a parameter, so what’s missing here?!

If you are trying to make you CT values more predictable, sigmoid filter is not the best solution. While it would be a good solution for the upper end of intensities, it would necessarily distort values on your relatively tight lower end.

As for choosing alpha and beta parameters, look at the intensity transformation formula in the documentation, then try plotting it in range (-2000…5000) for a few combinations of alpha and beta parameters to get a feel for how they influence the transfomation.

@zivy or @blowekamp might help with SITK-specific error.

Hello @Alsurayhi,

The usage of the SetX methods in the code is incorrect, should be:

sigmoid = sitk.SigmoidImageFilter()
sigmoid.SetOutputMinimum(-1024)
sigmoid.SetOutputMaximum(3000)
sigmoid.SetAlpha(alpha)
sigmoid.SetBeta(beta)
sigmoidOutput = sigmoid.Execute(img)

The sigmoid mapping in ITK/SimpleITK is f(I) = (max_{output} - min_{output}) \frac{1}{1+ e^{-\frac{I-\beta}{\alpha}}} + min_{output}

\beta is the intensity value for the sigmoid midpoint, \alpha is the curve steepness. For an example see this Jupyter notebook.

The more common mapping is IntensityWindowingImageFilter (a.k.a. Window-Level), linear mapping inside interval, with values below the lower bound mapped to a constant and values above the upper bound mapped to another constant.

1 Like