3d voronoi gradient based on image

Hi! I’m trying to create a script that can populate a geometry with voronoi cells where the density of the cells can be changed based on a image ( or even points or a line if that is easier.) I’ve been able to achieve this with a 2D voronoi but the 3D seems to cause issues. I’m curious if anyone has any ideas of where to start.