# Finding bounding box of the head model

**URL:** <https://discourse.slicer.org/t/finding-bounding-box-of-the-head-model/30097>\
**Category:** Support\
**Created:** [June 17, 2023, 12:47pm UTC](https://discourse.slicer.org/t/finding-bounding-box-of-the-head-model/30097 "2023-06-17T12:47:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammed\_Fatih\_Talu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muhammed_fatih_talu/32/14646_2.png) [@Muhammed\_Fatih\_Talu](https://discourse.slicer.org/u/Muhammed_Fatih_Talu)\
**Post date:** [June 17, 2023, 12:47pm UTC](https://discourse.slicer.org/t/finding-bounding-box-of-the-head-model/30097/1 "2023-06-17T12:47:25Z")

</div>

I’m trying to find the values of the bounding box that covers the model.  
But the code is very very slow. Is there a different way?

```auto
Widget = slicer.app.layoutManager().threeDWidget(0)
modelDispManager = Widget.threeDView().displayableManagerByClassName("vtkMRMLModelDisplayableManager")

k=1500; minx=k; miny=k; maxx=0; maxy=0;
for i in range(k):
    for j in range(k):
        if modelDisplayableManager.Pick(i,j) and modelDisplayableManager.GetPickedNodeID():
            if i<miny: miny=i;
            if j<minx: minx=j;
            if i>maxy: maxy=i;
            if j>maxx: maxx=j;
print("x:",[minx,maxx]," y:",[miny,maxy])

```
