# Particle swarm optimization in image

**URL:** https://discourse.itk.org/t/particle-swarm-optimization-in-image/4464
**Category:** Algorithms
**Created:** [September 30, 2021, 4:40pm UTC](https://discourse.itk.org/t/particle-swarm-optimization-in-image/4464 "2021-09-30T16:40:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jonas](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@Jonas](https://discourse.itk.org/u/Jonas)
#### Post date: [September 30, 2021, 4:40pm UTC](https://discourse.itk.org/t/particle-swarm-optimization-in-image/4464/1 "2021-09-30T16:40:56Z")

</div>

Hi,

I would like to experiment with Particle swarm optimization to see if I can retrieve some vessels centerlines from the sum of the paths of PSO particles.

The ITK implementation seems to work only to find minimums, so I ponderated a distance transform created from a seed point with a vesselness function (picture below).

I’ve looked into the test example, and I have two questions :

- Is there a nice way to serialize my image into the optimizer ? Or do I have to loop through the image and create pairs in a list ?
- Is there an interface to log the particles path along the iterative process, as this is my main objective ?

 ![image](https://discourse.itk.org/uploads/default/original/2X/0/09b8479bbb876725c921cdffd54409598e887433.jpeg)

Thanks,  
Jonas

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 27, 2021, 1:16pm UTC](https://discourse.itk.org/t/particle-swarm-optimization-in-image/4464/2 "2021-10-27T13:16:22Z")

</div>

Hi @Jonas ,

A few modules may be helpful:

- [ITKMinimalPathExtraction](https://github.com/InsightSoftwareConsortium/ITKMinimalPathExtraction)
- [ITKOptimizationMonitor](https://github.com/InsightSoftwareConsortium/ITKOptimizationMonitor)

Matt
