# Help Installing vtkITK module

**URL:** <https://discourse.slicer.org/t/help-installing-vtkitk-module/13451>\
**Category:** Development\
**Created:** [September 11, 2020, 8:51pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451 "2020-09-11T20:51:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [September 11, 2020, 8:51pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/1 "2020-09-11T20:51:10Z")

</div>

Hello,  
This isn’t exactly a Slicer question, but I thought someone on these forums may be able to help.  
I want to use vtkITK.vtkITKIslandMath  
However, I would prefer to use it on a regular Python installation instead of 3D Slicer.  
Can you pip install the module vtkITK? If so what is the syntax for this?  
python -m pip install vtkITK  
didn’t work for me.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 11, 2020, 9:03pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/2 "2020-09-11T21:03:30Z")

</div>

ITK island math filter may be available on PyPI via ITK or SimpleITK Python package.

If you want to use vtkITK package then you need to use the Python virtual environment provided by Slicer.

---

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [September 11, 2020, 11:07pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/3 "2020-09-11T23:07:50Z")

</div>

Thanks. I’ve decided to run this in Slicer. If you don’t mind, could you also let me know how to convert my image, which is a SimpleITK object, into a format that can be accepted by the vtkITKIslandMath filter? And also how to convert the output of this filter back into a SimpleITK object?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 12, 2020, 4:07am UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/4 "2020-09-12T04:07:44Z")

</div>

You can pass volumes between SimpleITK and Slicer scene using stikUtils. See example here: [https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Running\_an\_ITK\_filter\_in\_Python\_using\_SimpleITK](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Running_an_ITK_filter_in_Python_using_SimpleITK)

---

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [September 14, 2020, 5:49pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/5 "2020-09-14T17:49:25Z")

</div>

> [@rohan\_n](#):
>
> vtkITK.vtkITKIslandMath

Thanks, unfortunately vtkITKIslandMath only takes vtkAlgorithmOutput as an input, and I’m not sure how to get that.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 14, 2020, 5:55pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/6 "2020-09-14T17:55:02Z")

</div>

Since vtkITKIslandMath is derived from [vtkSimpleImageToImageFilter](https://vtk.org/doc/nightly/html/classvtkSimpleImageToImageFilter.html), it can use both data (`SetInputData()`) and connection (`SetInputConnection()`) as input, just as any other VTK filter.

---

<div class="post-metadata">

**Author:** ![dbtruong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dbtruong/32/65581_2.png) [@dbtruong](https://discourse.slicer.org/u/dbtruong)\
**Post date:** [June 12, 2023, 3:32pm UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/7 "2023-06-12T15:32:27Z")

</div>

Hi @lassoan, What is vtkITKIslandMath used for when the input is a binary image?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 2, 2023, 11:43am UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/8 "2023-07-02T11:43:17Z")

</div>

vtkITKIslandMath assigns unique label value to each connected region in an image. See details in its [documentation](https://apidocs.slicer.org/master/classvtkITKIslandMath.html).

---

<div class="post-metadata">

**Author:** ![dbtruong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dbtruong/32/65581_2.png) [@dbtruong](https://discourse.slicer.org/u/dbtruong)\
**Post date:** [July 3, 2023, 1:33am UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/9 "2023-07-03T01:33:59Z")

</div>

Does vtk have any similar library? @lassoan

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 3, 2023, 2:06am UTC](https://discourse.slicer.org/t/help-installing-vtkitk-module/13451/10 "2023-07-03T02:06:00Z")

</div>

I don’t think VTK has such filter. We only add those ITK filters to vtkITK that do not have an equivalent in VTK.
