Can we check and rescale pixel intensity values in Slicer?

I have a few Micro CT datasets. When I check in Python, I can see some intensity values are between 0 and 255 while some are like between 54 and 223. Since I am working with a machine learning model, I want all of them to be between 0 and 255, so my input is identical to each other. Is there a way to do this using Slice GUI, without scripting?

It is about four lines of code in python, and if you have a lot of samples, running them through UI will probably take longer.
Anyways, you can do it through Simple Filters->NormalizeImageFilter, and before feeding them into your ML pipeline, you can multiply the values by 255 (if you need to have them 0-255).

The more crucial question is why you have so much difference, which may have substantial effect on your ML pipeline if for example are 0-255 ones are full spectrum of the data, whereas 54-223 are somehow volumes cropped and there are no background voxels.

1 Like

Thank you for your input.

I used AHE from Simple Filters on each dataset to enhance contrast. This range difference happened after that. My original datasets were all between 0-255. I am wondering if I am doing something wrong.

This happens only when the Adaptive Histogram Equalization is applied after the Gaussian filter.

So there is no real consensus about whether this type of preprocessing is helping or hurting ML pipelines. My preference would have been to start with unprocessed data and then see if preprocessing improves (or deteriorates) the results compared to raw.


Thank you for your input :innocent: I will try that out.