How to open ".npy" file or convert ".npy" file to Paraview format?

Dear all,

I have a 3-dimensional volume array of size (64, 64, 64) which has an extension of “.npy”. I wanted to visualize in paraview so that I can do post-processing work from the software.

  1. Since, paraview does not support “.npy” file extension directly, how do I open it?

  2. I converted “.npy” file to “.raw” file extension and opened in ParaView with proper assignment of
    a. File Dimensionality: 3
    b. Data Extent: 0-64, 0-64, 0-64
    c. Data Scalar type: Unsigned char(int8).
    All I could see is a cube of (646464). But the volume is of different model.

  3. How do I convert “.npy” file to paraview readable extension?

Thanks and Regards,

Sunag R A.

That format is Python numpy’s compressed data format. It would be really nice to have a builtin reader for it.

Since there isn’t yet, I suggest a Python programmable source. It will have to get the word type and dimensions in request information, and pass down the values into a vtkImageData output in the script (IE request data) function.

If you hunt around in the cinema source code you can find examples for 2d images.

1 Like