class bone[source]

bone(data, dtype)

bone.get_xyz[source]

bone.get_xyz()

Convert 3D voxel array or STL to xyz coordinates.

filter_level (int/float): (inherited from bone class) sets the threshold level for what is considered a voxel. Everything below filter level is rounded to 0, everything above rounded to 1 (ie voxel)

returns: np.array( [n x 3] )

bone.get_pca[source]

bone.get_pca()

PCA on the xyz points array

xyz(np.array): n x 3 array of xyz coordinates

returns: self.pc1 self.pc2 self.pc3

bone.center_to_origin[source]

bone.center_to_origin()

sets the mean of the bone to 0,0,0

bone.center_to_origin[source]

bone.center_to_origin()

sets the mean of the bone to 0,0,0

bone.plot[source]

bone.plot(user_color=None, mesh=False, PCA_inv=False, PCA=True)

Plot voxels with optional PCA, and colours

user_color (tupple): RGB color of the bone where 1 is maxium eg: red = (1,0,0)

PCA (boolean): plots the PCAs of the voxel

PCA_inv (boolean): plots the inverse of each PCA so the axes go in both directions

bone.scale[source]

bone.scale(n, algo='constant')

up-scales the bone by n

n: scale factor

algo: method of upscaling array scipy.ndimagezoom(mode=...)

bone.xyz_to_array[source]

bone.xyz_to_array(array_dim=(256, 256, 256))

Converts xyz coordinates to numpy voxel array

bone.from_matlab_path[source]

bone.from_matlab_path(matlab_file)

Imports matlab file drectly

path: path object/string

retruns np.array (n x n x n )

bone.from_stl_path[source]

bone.from_stl_path(stl_file)

Imports stl file drectly

path: path object/string

retruns np.array (n x n x n )