If you load in a stl mesh (bone and cartilage), calculate thickness on the bone, and then try to smooth the surface scalars there is an error. This error is because the point coordinates are single precision and not double. Below is code to reproduce the error. The issue is occurring here: https://github.com/gattia/pymskt/blob/main/pymskt/cython/cython_functions.pyx. This is because the points in the mesh loaded via the below methods leads to float32 data instead of the double (float64) data expected by the gaussian_kernel function defined in cython_functions
The solution might be as simple as updating gaussian_kernel to allow types other than just double?
path_femur_mesh = 'path/femur.stl'
path_fem_cart_mesh = 'path/fem_cart.stl'
femur = BoneMesh(
pv.PolyData(path_femur_mesh)
)
fem_cart = CartilageMesh(pv.PolyData(path_fem_cart_mesh))
femur.list_cartilage_meshes = fem_cart
femur.calc_cartilage_thickness(
image_smooth_var_cart=0.1 # variance for the gaussian filter applied to the binary cart meshes b4 smoothing.
)
femur.smooth_surface_scalars(
smooth_only_cartilage=True,
scalar_sigma=1.6986436005760381, # This is a FWHM = 4
scalar_array_name='thickness (mm)',
scalar_array_idx=None
)
If you load in a stl mesh (bone and cartilage), calculate thickness on the bone, and then try to smooth the surface scalars there is an error. This error is because the point coordinates are single precision and not double. Below is code to reproduce the error. The issue is occurring here: https://github.com/gattia/pymskt/blob/main/pymskt/cython/cython_functions.pyx. This is because the points in the mesh loaded via the below methods leads to float32 data instead of the double (float64) data expected by the
gaussian_kernel
function defined incython_functions
The solution might be as simple as updating
gaussian_kernel
to allow types other than just double?