Creating a coefficient image from mask

Hi all,

what is the best way to create a coefficient image (in mhd format) with values between 0 and 1 from a segmented image (grayscale)? E.g. every pixel on the reference image with value 100 will hold the value 0.4 in the output image. Thanks in advance.

Regards
Michael

You should use RescaleIntensityImageFilter with uchar as input type and float as output type. Working out the offset and rescale coefficient should be easy.

1 Like

For the case with using SimpleITK you will have to first use the CastImageFilter with the output pixel type as sitkFloat32, then rescaling can be done by either using the above filter or simple multiplying by a scalar e.g. img * (0.4/100).