MATLAB: I have a ct image that values of pixel of it is between 0-4000 how can I convert it to an image with 0-255

convert ct image

I have a ct image that values of pixel of it is between 0-4000 how can I convert it to an image with 0-255 ?

Best Answer

There is a function that scales an array to 0-1. It's called mat2gray. Then just multiply by 255.
image8bit = uint8(255 * mat2gray(image16bit));