# measure lesion size

**URL:** <https://discourse.itk.org/t/measure-lesion-size/5469>\
**Category:** Algorithms\
**Created:** [November 5, 2022, 8:06pm UTC](https://discourse.itk.org/t/measure-lesion-size/5469 "2022-11-05T20:06:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura1](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura1/32/3034_2.png) [@Jakub\_Mitura1](https://discourse.itk.org/u/Jakub_Mitura1)\
**Post date:** [November 5, 2022, 8:06pm UTC](https://discourse.itk.org/t/measure-lesion-size/5469/1 "2022-11-05T20:06:50Z")

</div>

Hello I have a lesion in the 3d boolean array - 1 is presence 0 is absence - I would like to get the size of it in 3 axes - main longest axis and the other 2.  
Problem is that the long axis of the lesion generally do not agree with the axes of the image as a whole.  
Brute force approach to get the long axis is to iterate over all indicies and calculate euclidean distance taking spacing into account - but it is very slow.  
Is there some ready to use function to measure the lesion along its main axes  
or to have a measure of how elongated it is (how much it deviates from a sphere)?

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [November 6, 2022, 1:51am UTC](https://discourse.itk.org/t/measure-lesion-size/5469/2 "2022-11-06T01:51:07Z")

</div>

Hello @Jakub_Mitura1,

Yes there is. The relevant ITK filter is [LabelGeometryImageFilter](https://itk.org/Doxygen/html/classitk_1_1LabelGeometryImageFilter.html) and the function is `GetOrientedBoundingBoxSize`. If you are using SimpleITK this functionality is found in the [LabelShapeStatisticsImageFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1LabelShapeStatisticsImageFilter).

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura1](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura1/32/3034_2.png) [@Jakub\_Mitura1](https://discourse.itk.org/u/Jakub_Mitura1)\
**Post date:** [November 6, 2022, 6:11am UTC](https://discourse.itk.org/t/measure-lesion-size/5469/3 "2022-11-06T06:11:04Z")

</div>

Thank You!
