# Get voxel values as a CSV file

**URL:** <https://discourse.slicer.org/t/get-voxel-values-as-a-csv-file/27216>\
**Category:** Support\
**Created:** [January 12, 2023, 3:52pm UTC](https://discourse.slicer.org/t/get-voxel-values-as-a-csv-file/27216 "2023-01-12T15:52:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mmirzaa1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mmirzaa1](https://discourse.slicer.org/u/Mmirzaa1)\
**Post date:** [January 12, 2023, 3:52pm UTC](https://discourse.slicer.org/t/get-voxel-values-as-a-csv-file/27216/1 "2023-01-12T15:52:57Z")

</div>

Dear Andras  
Could you please determine how (using the code above) we can extract the voxel values as a table? or a csv file? thank you very much

---

<div class="post-metadata">

**Author:** ![Mmirzaa1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mmirzaa1](https://discourse.slicer.org/u/Mmirzaa1)\
**Post date:** [January 12, 2023, 4:14pm UTC](https://discourse.slicer.org/t/get-voxel-values-as-a-csv-file/27216/2 "2023-01-12T16:14:12Z")

</div>

Dear Andras  
To be more clear about my previous question, would it be possible to extract each voxel value with the corresponding X,Y,Z numbers, meaning the possibility of tabulating each voxels value with the exact location of the voxel  
thank you very much

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 12, 2023, 5:51pm UTC](https://discourse.slicer.org/t/get-voxel-values-as-a-csv-file/27216/3 "2023-01-12T17:51:15Z")

</div>

You can get the voxels as a numpy array (`a=array('MyVolumeName')`) and then use standard numpy functions (see for example [here](https://stackoverflow.com/questions/46852741/python-storing-values-in-a-3d-array-to-csv)).

However, I would not recommend doing this. Representing an image as a CSV file (one line per voxel) would be a horribly inefficient. Reading or processing would take several magnitudes longer time than using a standard 3D array representation (e.g., an operation that normally takes 0.1 second would take 100 seconds).

What would you like to compute from this CSV file?
