I have a 3D grid for representing shapes/meshes which is represented in python using an ndarray(20,20,20) of type bool. Each element in the grid represents the presence or absence of material. I want to be able to check if a given grid represents a shape that is connected all the way from the top of the grid to the bottom. I want to be able to discard those that are either disconnected or not occupying continuous series of cells from top of the grid to the bottom.
At a later stage I convert the grids into meshes using trimesh. Is there any way to identify the above either directly in python or through trimesh?