Creating a raw 3D voxel-based image (.raw or .tif)

Hello,

I am a beginner in image processing.

I prepared a sample of particles on a discrete element software and I am trying to obtain a raw 3D voxel-based image (.raw or .tif) for this sample, just as the one obtained in a micro-CT X-ray image.

I wrote a simple algorithm that can voxelize the domain(sample of particles) and I saved the data into file (.npy) consisting of voxels with a value of either 1 or 0 which represent if the voxel is inside a particle or in a void space;
My question is: Is it possible to convert this data (the position of each voxel and its type 0 or 1) to a .raw file or .tif file? if yes can you please tell me how.

The DEM software provides a .vtk file with only geometric data that can be converted into 3D surfaces using Paraview ,
my second question: Is there any possible way to convert this .vtu file to a raw 3D voxel-based images (.raw or .tif).

Thank you very much for helping me.
Ali