spheres_to_comsol

spheres_to_comsol(filename, im=None, centers=None, radii=None)[source]

Exports a sphere pack into a Comsol geometry file.

An image containing spheres can be specified. Alternatively as list of centers and radii can be given if known.

Parameters
  • filename (string or path object) – Location and namge to output file

  • im (ND-array (optional)) – A voxel image containing spheres indicated by non-zeros values. Spheres can be generated using a variety of methods and can overlap. The sphere centers and radii are found as the peaks in the distance transform. If im is not supplied, then centers and radii must be given.

  • centers (array_like (optional)) – An array (Ns, 3) of the spheres centers where Ns is the number of spheres. This must be specified if im is not suppplied.

  • radii (array_like (optional)) – An Ns length array of the spheres’s. This must be specified if im is not suppplied.

Notes

If im is given then some image analysis is performed to find sphere centers so it may not perfectly represent the spheres in the original image. This is especially true for overlapping sphere and sphere extending beyond the edge of the image.