Convert a 3D NumPy array of voxels to an STL file Given a 3D boolean array representing voxels, how can it be converted to a 3D-printer-ready file?

The end-goal I would like to achieve is to print the 3D shape that the numpy array represents (True coding for fill this voxel, False for leave it empty).

For example, the array

[
    [
        [T, T, T],
        [T, F, T],
        [T, T, T]
    ],
    [
        [T, F, T],
        [F, F, F],
        [T, F, T]
    ],
    [
        [T, T, T],
        [T, F, T],
        [T, T, T]
    ]
]


would encode a level-1 Menger sponge.
I agree with the use of OpenSCAD, but since it is difficult to program in OpenSCAD, I would use SolidPython, which is a front end for OpenSCAD with the full programming capability of Python.

In the alternative, you could use any programming language to decode your arrays and generate the OpenSCAD code for the little network of cubes (or voxels).

The final possibility is to generate an STL file directly.  I've helped someone do this, but we found the rules to be a little non-intuitive.  We used mesh tools to check out results, both by looking for error messages, and by displaying the result to see if it looked as we intended it to look.