# How to compute oriented bounding box for a model and display it using annotation ROI?

**URL:** <https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411>\
**Category:** Support\
**Tags:** python\
**Created:** [June 30, 2021, 2:04am UTC](https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411 "2021-06-30T02:04:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 30, 2021, 2:04am UTC](https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411/1 "2021-06-30T02:04:42Z")

</div>

In [Get size, position, and orientation of each segment](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-size-position-and-orientation-of-each-segment), I learned how to compute oriented bounding box for each segment and displays them using annotation ROI.  
I want to know how to compute oriented bounding box for a model and display it using annotation ROI .

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 30, 2021, 2:06am UTC](https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411/2 "2021-06-30T02:06:36Z")

</div>

or how to convert model to segmentation node with python?

---

<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:** [June 30, 2021, 2:27am UTC](https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411/3 "2021-06-30T02:27:58Z")

</div>

You can [load a surface mesh file as segmentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#load-a-3d-image-or-model-file-as-segmentation) or import a model into a segmentation node by calling [`slicer.modules.segmentations.logic().ImportModelToSegmentationNode(modelNode, segmentationNode)`](http://apidocs.slicer.org/master/classvtkSlicerSegmentationsModuleLogic.html#a19cdf27aa9e1068d6b39221600086f35).

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [June 30, 2021, 3:02am UTC](https://discourse.slicer.org/t/how-to-compute-oriented-bounding-box-for-a-model-and-display-it-using-annotation-roi/18411/4 "2021-06-30T03:02:58Z")

</div>

> [@lassoan](#):
>
> [`slicer.modules.segmentations.logic().ImportModelToSegmentationNode(modelNode, segmentationNode)`](http://apidocs.slicer.org/master/classvtkSlicerSegmentationsModuleLogic.html#a19cdf27aa9e1068d6b39221600086f35).

Thanks,谢谢老师! 🙂
