# Why does an \`itk::PointSet\` have "PointData"? Any existing use cases?

**URL:** https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235
**Category:** Algorithms
**Created:** [September 30, 2024, 1:20pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235 "2024-09-30T13:20:06Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [September 30, 2024, 1:20pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/1 "2024-09-30T13:20:06Z")

</div>

Obviously, `itk::PointSet` has a container of points (`m_PointsContainer`), but it also may have some extra data, named “PointData”, and stored in its `m_PointDataContainer`.

> <https://github.com/InsightSoftwareConsortium/ITK/blob/3b04ad1b377c6d5d77a2c1f454c363eab8197340/Modules/Core/Common/include/itkPointSet.h#L144>

As was introduced by @willschroeder, more than 23 years ago:

> <https://github.com/InsightSoftwareConsortium/ITK/commit/2efb105999611f83783cbfbed64e859beb9486d4>

Can anyone please tell me some existing use cases of these “PointData”?

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [September 30, 2024, 1:45pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/2 "2024-09-30T13:45:36Z")

</div>

It could be per-vertex color, or some other per-vertex measurement (thickness, curvature, strain, metabolic activity, etc).

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 1, 2024, 8:45am UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/3 "2024-10-01T08:45:52Z")

</div>

Thanks @dzenanz Are there any examples like that _in practice_? I’m interested to know how people are _actually_ using the PointData of a PointSet.

Your reply suggests that `PointSet::m_PointDataContainer` typically has one element per point, right? In code: `m_PointDataContainer->size() == m_PointsContainer->size()`

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 1, 2024, 1:12pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/4 "2024-10-01T13:12:02Z")

</div>

Here is an example of it being used to hold cartilage thickness:

> <https://github.com/uncbiag/OAI_analysis_2/blob/728fc41a66ae3c159ed41bde8365792d0fd8b617/oai_analysis/mesh_processing.py#L508>

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 1, 2024, 1:13pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/5 "2024-10-01T13:13:21Z")

</div>

Earlier in the same file, being set in ITK mesh:

> <https://github.com/uncbiag/OAI_analysis_2/blob/728fc41a66ae3c159ed41bde8365792d0fd8b617/oai_analysis/mesh_processing.py#L96>

---

<div class="post-metadata">

### Author: ![ntustison](https://discourse.itk.org/user_avatar/discourse.itk.org/ntustison/32/462_2.png) [@ntustison](https://discourse.itk.org/u/ntustison)
#### Post date: [October 7, 2024, 1:42am UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/6 "2024-10-07T01:42:54Z")

</div>

It’s in the [B-spline fitting filter](https://itk.org/Doxygen/html/classitk_1_1BSplineScatteredDataPointSetToImageFilter.html) I wrote. It can be used to create B-spline objects of an arbitrary number of parametric dimensions and an arbitrary number of data dimensions. Each point represents a location in the parametric (Point) domain and the corresponding PointData represents the data associated with that point.

So, for example, the B-spline filter is used in [N4](https://itk.org/Doxygen/html/classitk_1_1N4BiasFieldCorrectionImageFilter.html) where the scalar bias field values are the 1-D PointData at their image (i.e. parametric) locations. In contrast, the [B-spline SyN image method](https://itk.org/Doxygen/html/classitk_1_1BSplineSyNImageRegistrationMethod.html) also uses the B-spline filter where the displacement vectors are the n-D PointData at the image locations.

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 8, 2024, 3:11pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/7 "2024-10-08T15:11:08Z")

</div>

@dzenanz @ntustison Thank you very much for your examples. So clearly the point data doesn’t always just contain pixel values. (Even though the point data container is defined as a container of pixel values: [ITK/Modules/Core/Common/include/itkDefaultStaticMeshTraits.h at master · InsightSoftwareConsortium/ITK · GitHub](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkDefaultStaticMeshTraits.h#L129))

I wanted to know this because we are considering to add PointSet support to the library interface of [elastix](https://github.com/SuperElastix/elastix) But before doing so, I would like to know how it is actually being used, in practice 😃

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 8, 2024, 3:15pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/8 "2024-10-08T15:15:01Z")

</div>

Yes, in `PointSet`, `PixelType` is a placeholder for a name. It is essentially a per-vertex arbitrary data type, at least in C++.

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 8, 2024, 6:53pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/9 "2024-10-08T18:53:29Z")

</div>

Thanks! Do you agree that it also happens in practice that a `PointSet` does not need any PointData at all? I’m considering to submit another pull request that would allow instantiating a `PointSet<void>` (`TPixelType` = void), to indicate that a certain pointset never has any PointData.

But first I hope we can figure out how to fix [those Windows.Python SWIG errors from PointSetBase](https://github.com/InsightSoftwareConsortium/ITK/pull/4867#discussion_r1790748146)!

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 8, 2024, 7:15pm UTC](https://discourse.itk.org/t/why-does-an-itk-pointset-have-pointdata-any-existing-use-cases/7235/10 "2024-10-08T19:15:21Z")

</div>

> [@Niels\_Dekker](#):
>
> allow instantiating a `PointSet<void>` (`TPixelType` = void), to indicate that a certain pointset never has any PointData

Yes, this makes sense!
