Importing .raw files

I have a small 3D image in a .raw file. When I import it with the Image Reader, the ParaView assumes that scalars are associated with the corners of the voxels. Because of that, even with a categorical colormap, some interpolation is done, as can be seen on this image:


Additionally, the number of voxels is smaller than I would expect (with extents 0:8 there are 8 voxels and 9 corners (nodes)).
Is there a way to read my data in .raw file as voxels? This is example file (unsigned char, BigEndian, 1 scalar component, extents 0:9, 0:6, 0:2):
file.raw (210 Bytes)

If you have 10x7x3 voxel values, then your grid’s extents are [0:10, 0:7, 0:3], i.e. a grid of dimensions 11x8x4. You can read this binary file with the attached XMF description

file.xmf (760 Bytes)

Thank you very much for the answer, this works great. I had one problem with the file.xmf - in my version DataItem Format in line 16 should be “Binary”, “bin” is not valid, so I attach the corrected version.
file.xmf (822 Bytes)
One more question, can this effect be reproduced without using external scripts (using only the Paraview’s interface)? I do not know how to write such scripts for Paraview. I think that a .raw reader’s behavior should import data as voxels by default, but at least there should be an option.

You can script the usage of the .raw reader in ParaView. Tools -> PythonTrace.