# ConnectedComponentImageFilter vs HardConnectedComponentImageFilter

**URL:** https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379
**Category:** Algorithms
**Tags:** connected-components
**Created:** [January 13, 2025, 12:23am UTC](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379 "2025-01-13T00:23:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SteveRobbins](https://discourse.itk.org/user_avatar/discourse.itk.org/steverobbins/32/2446_2.png) [@SteveRobbins](https://discourse.itk.org/u/SteveRobbins)
#### Post date: [January 13, 2025, 12:23am UTC](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379/1 "2025-01-13T00:23:20Z")

</div>

I’ve got a binary image (a thresholded head MR) for which I want to obtain the connected components. I see there are two filters that look plausible:

- [ITK: itk::ConnectedComponentImageFilter\< TInputImage, TOutputImage, TMaskImage \> Class Template Reference](https://itk.org/Doxygen53/html/classitk_1_1ConnectedComponentImageFilter.html)
- [ITK: itk::HardConnectedComponentImageFilter\< TInputImage, TOutputImage \> Class Template Reference](https://itk.org/Doxygen53/html/classitk_1_1HardConnectedComponentImageFilter.html)

The first one says that the filter “experiments with some improvements to the existing implementation”. How experimental is it? Is the “existing implementation” still available in 5.3? If so, which filter? Is it more reliable?

I read the descriptions on the above pages but I can’t work out how to choose between the two filters. Are there use cases where one or the other is better suited?

---

<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: [January 13, 2025, 2:32pm UTC](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379/2 "2025-01-13T14:32:04Z")

</div>

`ConnectedComponentImageFilter` is one of the most used and well tested filters in ITK. The “existing implementation” might be `HardConnectedComponentImageFilter`, or has been removed from ITK long ago. Can you submit a PR removing mentions of experimentality from `ConnectedComponentImageFilter`? It is THE connected component filter.

---

<div class="post-metadata">

### Author: ![SteveRobbins](https://discourse.itk.org/user_avatar/discourse.itk.org/steverobbins/32/2446_2.png) [@SteveRobbins](https://discourse.itk.org/u/SteveRobbins)
#### Post date: [January 17, 2025, 11:52pm UTC](https://discourse.itk.org/t/connectedcomponentimagefilter-vs-hardconnectedcomponentimagefilter/7379/3 "2025-01-17T23:52:31Z")

</div>

OK, see [DOC: Revise class documentation, remove term 'experimental' by smr99 · Pull Request #5141 · InsightSoftwareConsortium/ITK · GitHub](https://github.com/InsightSoftwareConsortium/ITK/pull/5141)
