Converting .csv Files to 3D Plots (stuck!!)

I have multiple .csv files that I need to convert in ParaView. I have followed the following steps:

  • Open your .csv file, Apply
  • Filter → Table to points
  • Set X to x, Y to y, Z to z, Apply
  • Filter → Delaunay 3D, Apply

But ParaView gets stuck and crashes when I apply the Delaunay 3D filter. This is likely because my .csv is so large.

One .csv file that is 262,145 rows long took about 10 minutes to apply the Delaunay 3D filter. I have two more .csv files that are 2,097,151 rows and 16,777,215 rows long. Both are getting stuck and crashing after 5 HOURS. Is there some way I can automatically convert the .csv to an .xdmf or some other ParaView file? Or at least a quicker way??

Thanks,
Elise

Are the points arranged regularly into a grid by chance? If so, then the Table to Structured Grid filter would be much faster than Delaunay 3D.

Hi Cory,

Thanks for the quick reply. Do you mean using Table to Structured Grid instead of Table to Points? Or using Table to Points then Table to Structured Grid? After using Table to Structured Grid, how do I view it in 3D?

Honestly, I am not sure if my points are arranged into a grid. I am relatively new to excel. How do I check this?

Yes, that is what I meant.

The outer surface of the structured grid will be displayed as a solid surface by default.

What is your end goal? Do you want to see the X, Y, Z points in space? Or are you trying to create an unstructured grid from the points (that’s what Delaunay 3D does).

Hi Cory,

My end goal is to produce an image like the one shown below. I have the x, y, and z coordinates in a .csv file that I need converted to a 3D image.

In that case, Table to Structured Grid should work, as long as your input XYZ points are ordered in a way such that they trace through lines of the grid structure systematically first along one dimension, then the next, then the third.

Set the Whole Extent to

0, nx-1
0, ny-1
0, nz-1

where nx, ny, and nz are the dimensions of your grid in the CSV file. Then choose the X Column array, Y Column array, and Z Column array to be the matching column from the CSV file.

Hi Cory,

This is a screenshot of my window:

I uploaded the .csv, and then used Table to Structured Grid with Whole Extent to 0-64 for each of the directions, as well as setting the columns properly. Nothing is showing up. Do I need another filter, too?

If you can share the sample file, it’ll be easy to figure out what’s going on.

FILENAME2000.csv (173.5 KB)

Here is one of the files that is smaller, only 4096 rows (16^3). The larger one is too large to upload. It is too large to even view in Excel at 2,097,152 rows long (128^3). By the way, I got the Table to Structured Grid working, but this is what it looks like:

I want it to be a cube, not just show the axes outline. Just to note, it is the larger one that I am having trouble with ParaView. It gets stuck.

The issue is that rows are not ordered correctly. Attached is the same CSV with columns sorted by x, y and z.

sorted.csv (173.5 KB)

here’s the result:

Hi Utkarsh,

I just want to double check something, the x, y, and z columns are the coordinates for the voxels (points). These coordinates remain the same, it is just sorted in the x column right? But the corresponding y and z values remain the same?

yes, unless I messed up using Excel…I don’t use it often, so I’d recommend you generate the sorted version for yourself, correctly.

No, that worked! Thank you very much

thank you very much @utkarsh.ayachit I had the same problem
Is there a way to import or process the grid but with the point in the centroid of the cube?

I would like something like this

I have something like this

At the end I would like to assign a color to every cube based upon its value like this

You can use the Cell Centers filter to place points at the centers of the hexes, then add a Glyph filter with the Glyph Type set to “Sphere”.

Thank you @cory.quammen

However, I would like to use the points like a centroid for every cube, because when I use the Threshold filter to the cells, in my example values > 4 for Au_SGS, and I repeat the same range for the points with a Extract Selection filter, the points and the cubes don’t match

I would like to see this, where the points and cubes match and even I can assign a color for every point and cube based in its value

When I use the Cell Centers filter I get the centroid points but I lost the values of the points and it is not posible to assign a color map to every point, furthermore, due to I am getting the centroid points from the extracted cells (Au_SGS > 4) the centroids points are not what I expected, it is missing some cells and points

It’s unfortunate Cell Centers doesn’t copy the cell data. That’s supported in the underlying VTK filter, just not made available in the ParaView exposure of that filter.

As a workaround in the version of ParaView you have, you can apply a Resample With Dataset filter. Set the “Source Data Arrays” input to your “Threshold>4” filter, and the “Destination Mesh” to the “CellCenters1” filter. That will give resample the data arrays onto the cell centers.

Thanks @cory.quammen it looks bettter

is it possible to add the labels for the points? like this:

You can add data labels for points that are selected, but this will affect the coloring of the data. To add labels, select from the Edit menu the Find Data item.

Under the Selection Display section in the Find Data panel, look for the popup menu labeled “Point Labels”. Pick the data array you want to use for labels. You should see the points labeled with their data values.

I note that this discussion had diverged quite a bit from the original question in multiple ways, but to circle back to using Threshold on the cell centroid, you can now use the Append Location Attributes filter on the original data. This will add a CellCenters field that you can run Threshold and other filters on.

Of course, Append Location Attributes will not let you see the centroids, so you will still need to use Cell Centers to see the dot in the middle.