# Importing .raw files

**URL:** https://discourse.paraview.org/t/importing-raw-files/2956
**Category:** ParaView Support
**Created:** [November 11, 2019, 9:02pm UTC](https://discourse.paraview.org/t/importing-raw-files/2956 "2019-11-11T21:02:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![usiu5555](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/u/e19adc/32.png) [@usiu5555](https://discourse.paraview.org/u/usiu5555)
#### Post date: [November 11, 2019, 9:02pm UTC](https://discourse.paraview.org/t/importing-raw-files/2956/1 "2019-11-11T21:02:02Z")

</div>

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:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/9/95519e098fa8970f0b62ffbc6d11f082468784c8.png)  
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](https://discourse.paraview.org/uploads/short-url/4ArswtsOVkvx5xlPWtebTlnGaV1.raw) (210 Bytes)

---

<div class="post-metadata">

### Author: ![jfavre](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jfavre](https://discourse.paraview.org/u/jfavre)
#### Post date: [November 12, 2019, 3:27pm UTC](https://discourse.paraview.org/t/importing-raw-files/2956/2 "2019-11-12T15:27:27Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/8wKE7840JV7OsFfOKt4bXkoVlgE.xmf) (760 Bytes)

---

<div class="post-metadata">

### Author: ![usiu5555](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/u/e19adc/32.png) [@usiu5555](https://discourse.paraview.org/u/usiu5555)
#### Post date: [November 13, 2019, 9:58am UTC](https://discourse.paraview.org/t/importing-raw-files/2956/3 "2019-11-13T09:58:24Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/lC6Yr3eCAUFz3mG0NUkXmOuq8If.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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 13, 2020, 5:16am UTC](https://discourse.paraview.org/t/importing-raw-files/2956/4 "2020-02-13T05:16:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![richiwalt](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@richiwalt](https://discourse.paraview.org/u/richiwalt)
#### Post date: [August 11, 2020, 4:47am UTC](https://discourse.paraview.org/t/importing-raw-files/2956/5 "2020-08-11T04:47:08Z")

</div>

This absolutely worked for me with pure binary data … placing on a uniform grid. Perfect. But my question is: Can I accomplish the same results with a pvpython script with some reader to read the straight binary raw data ?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 11, 2020, 7:21am UTC](https://discourse.paraview.org/t/importing-raw-files/2956/6 "2020-08-11T07:21:04Z")

</div>

> [@mwestphal](#):
>
> You can script the usage of the .raw reader in ParaView. Tools → PythonTrace.

Using tools → Python trace, you can figure out how to script GUI actions.
