So I was reading a lot about things in scripts depository. I just learned how to change the background color to white and I am interested to learn more about python in general.
I read a lot and a word 'numpy array" keeps coming up.
What is a “numpy array”?
Get axial slice as numpy array
import SampleData
volumeNode = SampleData.SampleDataLogic().downloadMRHead()
sliceIndex = 12
voxels = slicer.util.arrayFromVolume(volumeNode) # Get volume as numpy array
slice = voxels[sliceIndex:,:] # Get one slice of the volume as numpy array