# VTK Polydata dataset with points only?

**URL:** https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293
**Category:** Support
**Created:** [September 24, 2020, 10:42pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293 "2020-09-24T22:42:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pjdf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@pjdf](https://discourse.vtk.org/u/pjdf)
#### Post date: [September 24, 2020, 10:42pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/1 "2020-09-24T22:42:47Z")

</div>

I have a legacy POLYDATA dataset with only points and associated SCALARS (no CELLS) from some hydrologic simulation code. The only important piece of information is the location of the points themselves. I have two questions:

1. Is having a CELLS field necessary?
2. If so, how should I define such cells? Can I just define a single cell over the whole volume with the points?

This seems like a basic question but I haven’t ben able to answer this question with previous searches. Thanks for your help!

-James

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [September 25, 2020, 4:06pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/2 "2020-09-25T16:06:30Z")

</div>

In next release, you will be able to instantiate `vtkPointSet`, which will not be abstract anymore, and which will be the designated data structure for point sets. As for now, if you want to display points in a `vtkPolyData`, you should fill up the `vtkCellArray` you can get from `vtkPolyData::GetVerts()`. Your cells would be `vtkVertex`.

---

<div class="post-metadata">

### Author: ![pjdf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@pjdf](https://discourse.vtk.org/u/pjdf)
#### Post date: [September 28, 2020, 9:29pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/3 "2020-09-28T21:29:33Z")

</div>

Hi Yohann,

Thanks for the help!

I think I wasn’t clear enough in my first question. The VTK polydata file is being written manually in a FORTRAN code, and the only parts that are written are the POINTS and the SCALARS.

So it looks like:

* * *

DATASET POLYDATA  
POINTS n dataType  
p0x p0y p0z  
p1x p1y p1z  
…  
p(n-1)x p(n-1)y p(n-1)z

SCALARS dataName dataType numComp  
LOOKUP\_TABLE tableName  
s0  
s1  
…  
sn-1

* * *

It doesn’t have any polygons or cells. I’m trying to figure out: 1) whether this is a valid legacy VTK file format that readers should recognize (I can get the data out of it in Python, but that’s the only one I’ve gotten working so far, with particularly VisIt and ParaView having problems); and 2) what I need to do to adapt the file format if it is not. I have had one person tell me that the VTKs need a structure for the data to lay in, and hence a set of CELLS, so I’m trying to track down more of that.

Since the data doesn’t have any vertices or cells, I don’t get anything when I call vtkPolyData::GetVerts().

Thanks a bunch for your help!

Be Well,  
James

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [September 28, 2020, 9:44pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/4 "2020-09-28T21:44:41Z")

</div>

Hi James,

I’m not very familiar with legacy formats, but I think you should be able to find everything you want [here](https://lorensen.github.io/VTKExamples/site/VTKFileFormats/).

From what I can tell, if you replace `SCALARS` by `POINT_DATA` and add a `VERTICES` section mapping points to vertices, you should be good.

---

<div class="post-metadata">

### Author: ![pjdf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@pjdf](https://discourse.vtk.org/u/pjdf)
#### Post date: [September 28, 2020, 10:27pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/5 "2020-09-28T22:27:55Z")

</div>

Hi Yohann,

Thanks a bunch.

If I understand what you’re saying, I need to add a vertices section that repeats the points section (with a unique number for each vertex?) because I need to let it know that the points are not parts of cells, but rather are just stand-alone locations in space.

I think that the SCALARS should remain as they are, because in fact it reads:

* * *

POINT\_DATA  
SCALARS dataName dataType  
LOOKUP\_TABLE default  
s0  
s1  
…  
sn-1  
SCALARS dataName dataType  
LOOKUP\_TABLE default  
ss0  
ss1  
…  
ssn-1

* * *

Sorry–I was not careful enough before to make sure I got the whole relevant portion.

Let me know if this makes sense, and thanks a bunch for your help!

Be Well,  
James

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [September 29, 2020, 12:55pm UTC](https://discourse.vtk.org/t/vtk-polydata-dataset-with-points-only/4293/6 "2020-09-29T12:55:59Z")

</div>

Yes, you got it all right.
