Voxel cube data to fem cubic element mesh


I would like to convert a voxel cube data to fem cubic mesh for Fenics. In other words, I want to treat one voxel directly as an element in my analysis. Does anyone have idea how to achieve that? Thanks.

I would use DOLFINx, as it supports hexahedral elements. It would not be too hard to read the voxel based data into an appropriate DG-0 function space.