Hi, some python demo about pca.
- how to pca a vector set:
import numpy as np
from numpy.linalg import eig
e,v = eig(np.cov(xyz))
- how to collect vector set form volumn
from scipy.ndimage import label
lab, n = label(imgs)
# to get the x th object:
xyzs = np.where(imgs==x)
# then do pca ...
but the code upon is not utillity when the volume has many object, that 's python’s limmit. If we use for loop to iter the pixels, that will be too slow. but thanks for many site-packages, such as skimage
- count many properties for every object in a volume
from skimage.measure import lab, regionprops
buf, n = label(imgs, strc, output=np.uint32)
ls = regionprops(buf)
for obj in ls:
# obj.xxx, there are many properties (also the pca in), you can see the document
- at last, recommend ImagePy, a ui tool like imagej, but built on python data. https://github.com/Image-Py/imagepy, there are also an 3d object analysis plugin. https://github.com/Image-Py/imagepy/blob/master/imagepy/menus/Kit3D/Analysis%203D/regionprops3d_plgs.py, you can use it from uitool, and you can also reference the code in.
May be I did not understand your question well, but the code could be helpful.