How to apply intensity normalization to MRI(.mha) with Slicer

I am working with a project of brain segmentation and need to preprocess my MRI(from BRATS2015). I have applied N4ITK within Slicer, but I cannot find out how to apply intensity normalization with Slicer 4.6.2. Or is there any normal ways I can use to normalize my MRI.
And,I want to look the histogram of MRI 3D to do it?
Thank you all!!!

You can use SimpleFilters and the NormalizeImageFilter and then look at the histogram in the Volumes module.


hi,i apply on my files.But the result is not my want to get.I want to get like:01

yes,but it has some problem

If you want to normalize all the images to the same range then you’ll need to write a small script. There’s not built-in tool that does that. If you are comfortable writing a script but want specific suggestions let us know.

For more refined, interactive plotting, you can create a histogram and show in a plot view, as it is done in this example:


This is very helpful, how would you suggest doing this if you want compare the histograms of multiple images as in the images above?

basically make a loop around this for each image? is there a way to get the histogram that is already shown in the volumes module and plot that blue line for each image?

You can add any number of series in a chart. So, yes, you can just iterate through all relevant volume nodes, create a plot series for each, and add it to the chart.

Volumes module only computes histogram for the currently selected volume and I’m not sure that even this histogram is exposed through a public API.

Since you can compute the histogram in near-zero time, with a single line of code, with full control of histogram bins, it makes sense to follow the method shown in the example Python script.

Note that in recent nightly builds, slicer.util.plot function can even furher simplify the syntax:

# Get a volume node
import SampleData
volumeNode = SampleData.SampleDataLogic().downloadMRHead()

# Plot histogram
import numpy as np
histogram = np.histogram(arrayFromVolume(volumeNode), bins=50)
chartNode = plot(histogram, xColumnIndex = 1)
1 Like