Measure variance
SciPy measurement functions allow you to tailor measurements to specific sets of pixels:
- Specifying
labelsrestricts the mask to non-zero pixels. - Specifying
indexvalue(s) returns a measure for each label value.
For this exercise, calculate the intensity variance of vol with respect to different pixel sets. We have provided the 3D segmented image as labels: label 1 is the left ventricle and label 2 is a circular sample of tissue.
After printing the variances, select the true statement from the answers below.
Este ejercicio forma parte del curso
Biomedical Image Analysis in Python
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Variance for all pixels
var_all = ndi.variance(vol, labels=None, index=None)
print('All pixels:', var_all)
# Variance for labeled pixels
var_labels = ndi.variance(____, _____, ____)
print('Labeled pixels:', ____)
# Variance for each object
var_objects = ____
print('Left ventricle:', var_objects[0])
print('Other tissue:', ____)