# Get a leftmost/rightmost coordinate with SimpleITK

**URL:** <https://discourse.slicer.org/t/get-a-leftmost-rightmost-coordinate-with-simpleitk/18811>\
**Category:** Support\
**Created:** [July 20, 2021, 8:45am UTC](https://discourse.slicer.org/t/get-a-leftmost-rightmost-coordinate-with-simpleitk/18811 "2021-07-20T08:45:51Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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 23, 2021, 12:46pm UTC](https://discourse.slicer.org/t/get-a-leftmost-rightmost-coordinate-with-simpleitk/18811/7 "2021-07-23T12:46:21Z")

</div>

You cannot implement such low-level image processing in Python. They would be way too slow. For example to iterate through a tiny 100x100x100 image you would do 1 million iterations. In C++ or other low-level languages this would take a fraction of a second, while in Python in can take minutes.

Instead, you need to think about how you can implement a feature using high-level operations. For example, you can do the projection that you described above by copying the entire shape shifted by one pixel, repeated 100 times, and it would be magnitudes faster than implement iterating through each pixel of the image.

I guess you are still working on this:

> [@Do projection from polydata to a model surface](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/5):
>
> I’ve tried, but this module seems not to suit for my case. I already have chest model so I don’t have to use markup points to create the chest wall. Because the chest wall in breast reconstruction module is created by markup points, and markup points are situated on the breast model, it can create a closed model obviously. However, in my module, the chest wall model is from CT, and the breast model is from 3d scan, they are aligned but with some distance. I think these two modules have diffe…

I would recommend to have a look at the existing Slicer module for almost the same task ([GitHub - PerkLab/BreastReconstruction: Tool for breast reconstruction surgery planning](https://github.com/PerkLab/BreastReconstruction)) because we already have this kind of projection implemented in it.

---

_[View the full topic](https://discourse.slicer.org/t/get-a-leftmost-rightmost-coordinate-with-simpleitk/18811)._
