Need help displaying processed NumPy array properly.

I have a model that uses NumPy arrays. The inputs and outputs are those arrays.

I want to display this on a webpage and I’m struggling with that.

I believe the problem I’m facing is that out model uses marching cubes which is based on vectors but VTK uses scalars. Because of that, I’m getting a cuboid instead of a lung, that I should be getting.

I restarted, using this as a wireframe but I’m still getting a block. I have tried opacity and colour settings but the block doesn’t go. I guess that my code is quite literally displaying the NumPy array instead of what I want from it.

PyVista gives me a lung but it’s not flawless either.

Please let me know how I can properly display my NumPy array. If not, how can I convert it to a VTK object or a VTK array and how can I display that?

Thank you.