Get startedGet started for free

Separate histograms

A poor tissue segmentation includes multiple tissue types, leading to a wide distribution of intensity values and more variance.

On the other hand, a perfectly segmented left ventricle would contain only blood-related pixels, so the histogram of the segmented values should be roughly bell-shaped.

For this exercise, compare the intensity distributions within vol for the listed sets of pixels. Use ndi.histogram, which also accepts labels and index arguments.

This exercise is part of the course

Biomedical Image Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create histograms for selected pixels
hist1 = ndi.histogram(vol, min=0, max=255, bins=256)
hist2 = ndi.histogram(vol, 0, 255, 256, labels=____)
hist3 = ndi.histogram(vol, 0, 255, 256, labels=____, index=____)
Edit and Run Code