Mulai sekarangMulai gratis

Measure variance

SciPy measurement functions allow you to tailor measurements to specific sets of pixels:

  • Specifying labels restricts the mask to non-zero pixels.
  • Specifying index value(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.

Labeled Volume


After printing the variances, select the true statement from the answers below.

Latihan ini merupakan bagian dari kursus

Biomedical Image Analysis in Python

Lihat Kursus

Latihan interaktif langsung praktik

Cobalah latihan ini dengan melengkapi kode contoh ini.

# 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:', ____)
Edit dan Jalankan Kode