Get voxel values as a CSV file

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

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

You can get the voxels as a numpy array (a=array('MyVolumeName')) and then use standard numpy functions (see for example here).

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?