Rescale intensity



In order to get rid of some very bright spots in my images (which I can not remove by smoothing, because I need to keep other speckles), I would like to rescale the intensity. I want to set the intensity from the original image that should be set to the highest value in the rescaled image to the level (0.5) of my real objects and this works. However, I would like to keep the original intensities of all pixels below this value (i.e. I don’t want the intensity to be stretched to the full scale). Therefore I set 0 for the minimum intensity of the rescaled image and 0.5 for the maximum intensity of the rescaled image, but the resulting rescaled image still contains objects with an intensity of 1. Again, what I want to do is to decrease the intensity of very bright pixels to 0.5 while keeping the intensity values of all pixels up to 0.5.

I would be very grateful for a suggestion.

kind regards



Hi DS,

Have you tried ApplyThreshold, from the Image Processing Module category? It seems as though it addresses your issue. Quoting from the Help on that module:

% If you wish to threshold bright pixels, change the value for which
% “Pixels above this value will be set to zero”. In this case, you can
% expand the thresholding around them by entering the number of pixels to
% expand here: This setting is useful to adjust when you are attempting to
% exclude bright artifactual objects: you can first set the threshold to
% exclude these bright objects, but it may also be desirable to expand the
% thresholded region around those bright objects by a certain distance so
% as to avoid a ‘halo’ effect.



Hi David,
I have a similar problem, and with your suggestion the pixels that are too bright would become black (=value), while I would like to make them equal to the upper value (for example 0.5).
I tried with the option enter min and max in the module rescaleintensity, but a misterious error appear (see below)
Do you have any idea how to resolve the issue of compressing the highest pixels?
Thanks a lot for your help

There was a problem running the image analysis. Sorry, it is unclear what the problem is. It would be wise to close the entire CellProfiler program in case something strange has happened to the settings. The output file may be unreliable as well. Matlab says the error is: Undefined function or method ‘min’ for input arguments of type ‘cell’. in the RescaleIntensity module, which is module #03 in the pipeline.

CPrescale in C:\Dokumente und Einstellungen\luca\Eigene Dateien\software\CellProfiler\CellProfiler_1.0.5122_XP32\CellProfiler_1.0.5122_XP32\CellProfiler_mcr\CPsubfunctions\CPrescale.m (103)
RescaleIntensity in C:\Dokumente und Einstellungen\luca\Eigene Dateien\software\CellProfiler\CellProfiler_1.0.5122_XP32\CellProfiler_1.0.5122_XP32\CellProfiler_mcr\Modules\RescaleIntensity.m (141)
AnalyzeImagesButton_Callback in C:\Dokumente und Einstellungen\luca\Eigene Dateien\software\CellProfiler\CellProfiler_1.0.5122_XP32\CellProfiler_1.0.5122_XP32\CellProfiler_mcr\CellProfiler\CellProfiler.m (9409)
gui_mainfcn in C:\Dokumente und Einstellungen\luca\Eigene Dateien\software\CellProfiler\CellProfiler_1.0.5122_XP32\CellProfiler_1.0.5122_XP32\CellProfiler_mcr\CellProfiler\CellProfiler.m (11138)
CellProfiler in C:\Dokumente und Einstellungen\luca\Eigene Dateien\software\CellProfiler\CellProfiler_1.0.5122_XP32\CellProfiler_1.0.5122_XP32\CellProfiler_mcr\CellProfiler\CellProfiler.m (55)


Hi Luca,

Would you be able to upload your pipeline and the data which produced the error to the forum (you can do that under “Upload Attachment” below)? That way, we can take a look directly.



Hi Luca,

Check out this post, which (unfortunately) may be applicable.




Hi all,

We’re recently updated the RescaleIntensity module with the following:
(a) It will not rescale to [0,1] for the min/max rescaling method (as per DS’s observation)
(b) You can add values specifying what values you would like pixels that fall above/below the min/max values to have. This may be useful as a simple method of thresholding.

These changes will be reflected in the next release of CellProfiler, several weeks from now.



Is there any function in the current version of cell profiler that would mimic the (original) rescale intensity function?