# Select closed volume

**URL:** https://discourse.vtk.org/t/select-closed-volume/5394
**Category:** Support
**Created:** [March 17, 2021, 8:53am UTC](https://discourse.vtk.org/t/select-closed-volume/5394 "2021-03-17T08:53:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [March 17, 2021, 8:53am UTC](https://discourse.vtk.org/t/select-closed-volume/5394/1 "2021-03-17T08:53:50Z")

</div>

Dear All,

If I have a single volume (in VTK terms) formed by several closed “volumes”. How I select the points of one of those “volumes” and for example change the color of it?

Perhaps, selecting one of the points of the “volume” a find the other points by propagation.

ITK package?

Thanks,

Luís Gonçalves

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [March 17, 2021, 11:18am UTC](https://discourse.vtk.org/t/select-closed-volume/5394/2 "2021-03-17T11:18:18Z")

</div>

Is the volume boundary represented by a surface (via vtkPolyData or vtkUnstructuredGrid)? If so, if you know one point on the volume, and the surface is connected, you can use vtkPolyDataConnectivityFilter or vtkConnectivityFilter to extract / select the surface.

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [March 17, 2021, 11:44am UTC](https://discourse.vtk.org/t/select-closed-volume/5394/3 "2021-03-17T11:44:01Z")

</div>

The volume has intensity value 255 and the in the frontier/edge passes to 0. All structured images.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 17, 2021, 2:24pm UTC](https://discourse.vtk.org/t/select-closed-volume/5394/4 "2021-03-17T14:24:09Z")

</div>

Such labelmap editing operations (split to island, assign color to each island, etc.) are available in 3D Slicer’s Segment Editor module. It uses VTK filters or ITK filters wrapped in VTK filter interface. You can use everything in 3D Slicer as is, or copy-paste the code into your project and maintain it yourself.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 17, 2021, 2:25pm UTC](https://discourse.vtk.org/t/select-closed-volume/5394/5 "2021-03-17T14:25:52Z")

</div>

Within VTK, for vtkImageData, the [vtkImageConnectivityFilter](https://vtk.org/Wiki/VTK/Image_Connectivity) can be used to label enclosed regions.

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [March 26, 2021, 5:51pm UTC](https://discourse.vtk.org/t/select-closed-volume/5394/6 "2021-03-26T17:51:15Z")

</div>

Thanks. It worked.
