How to find a cell/element using a point location inside it?

I have two geometries imported in paraview, one of them is arm cells and points and the other one is the artery mesh inside it. I want to know what elements in my arm are artery elements/cells using the artery mesh. Therefore, I looked at my artery and my arm and manually managed to find some of the matching elements. However, this is very frustrating. I had another idea to find some points in my artery and then find the nearest arm cells to those locations which is better. However, this is not very practical. Is there any better way to do it automatically using a filter or a python code?

Not sure if i understand, but here goes. You have two datasets loaded (i.e., geometries). I’m assuming you are using a modern ParaView (i.e., 5.6.0 or master). Use the Find Data dialog. (Icon below the Catalyst menu). Now, find Points from Artery Dataset. Below that, change ID to Point. Next, type in coordinates. Run Selection Query.

You probably won’t see the selected point. Change representation to point, or wireframe. Alternatively (or also), Properties/ Opacity to 0.15.

For Cell, change the above to Cell and Cell.

A practice dataset is File/ Open/ Examples/ disk_out_ref.exo. Find the point and cell at location 0,0,5.
Is this what you are looking for?

1 Like

Hi Walter,

I am using ParaView 5.5.0. Please see the image below. What I did is I selected a point on my artery and found its location (200,80,100). Then using this location I used Find Data dialog on my arm dataset and found the cell

number 115282 so now I can say that artery passes this cell. I want to find all other cells as well. So this works for one or two cells but for hundreds of these cells I need to do this. Let’s say I have a list of locations, how can I find all the cells corresponding to these locations?



So, you read in two different datasets, correct? Maybe turn visibility off on one of them, and then select block? (little icon above the 3d view)?

1 Like

Try this. Load both your arm and artery datasets. Add the Resample With Dataset filter. Set the Input to the artery data and the Source to the arm data. This will sample the field data of your arteries into the arm mesh. You probably don’t actually want that (maybe your arteries don’t even have field), but Resample With Datase also creates a special vtkValidPointMask that will be 1 for points inside a cell in the artery data set and 0 for those outside. You can use that to identify the cells of the arm that are inside the cells of the artery.

Note that this will not be perfect. This will only identify when a point of the arm mesh lies within a cell of the artery mesh. If the artery passes through the middle of an arm cell without containing any points, nothing will get identified. Also, if your arteries are represented as a hollow tube of polygons (as opposed to, say, tetrahedrons filling in the artery), then this will not really work.

1 Like

I used select block but it did not work. Could you please explain more?

Thanks, I did not know about this filter. My artery is just a surface mesh but my arm is a volume mesh, so as you explained it, this filter did not work. I got 0 for all cells. Do you have any idea how to make this work or should I generate a volume mesh for it first?

If you could generate the artery mesh as a solid tube, that would probably be the easiest solution.

An alternate solution could be to sample the arm mesh with the artery mesh (instead of sampling the artery mesh with the arm mesh) to get a field containing cell ids that are intersected. However, that would take several more steps to get to that point, and then it would probably be difficult to do anything useful with the resulting field of ids that you get.

1 Like

Thanks, I make a solid mesh which is easier. Is it possible to make a solid mesh in ParaView? I see there is a Delaunay3D filter but it produces a strange thing.

Yes, Delaunay3D is pretty much the way you can create a solid mesh in ParaView. Unfortunately, it always creates a mesh that fills the convex hull of the data set. Although it is easy for a human to see that your mesh is a supposed to be a tube, trying to identify that programmatically is quite difficult, so the Delaunay3D filter makes a simplifying assumption that is easy to model mathematically.