# Collision Detection Capabilities in 3D Slicer

**URL:** <https://discourse.slicer.org/t/collision-detection-capabilities-in-3d-slicer/14854>\
**Category:** Development\
**Tags:** slicerrt, python\
**Created:** [December 2, 2020, 7:59pm UTC](https://discourse.slicer.org/t/collision-detection-capabilities-in-3d-slicer/14854 "2020-12-02T19:59:40Z")\
**Posts on this page:** 2\
**Page:** 2

<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:** [May 8, 2021, 10:19pm UTC](https://discourse.slicer.org/t/collision-detection-capabilities-in-3d-slicer/14854/21 "2021-05-08T22:19:41Z")

</div>

> [@Hikmat](#):
>
> Yes, this is the crux of the problem, in that I do not know how to extract the transforms from the model nodes so that I can pass them into the collision detection filter.

You can get transform using `transformNode.GetMatrixTransformToParent(transformMatrix)`. See many examples in the [Slicer script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html).

---

<div class="post-metadata">

**Author:** ![ferhue](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ferhue/32/82557_2.png) [@ferhue](https://discourse.slicer.org/u/ferhue)\
**Post date:** [September 1, 2021, 11:02am UTC](https://discourse.slicer.org/t/collision-detection-capabilities-in-3d-slicer/14854/22 "2021-09-01T11:02:38Z")

</div>

> [@Hikmat](#):
>
> I have tried following the example in how the transforms were set, but I still have Slicer 4.13 crashing on me upon the `GetNumberOfContacts()` function call.

I experienced the same crash recently. I have filed a bug report:

> **[vtkCollisionDetectionFilter segfault (#18298) · Issues · VTK / VTK · GitLab](https://gitlab.kitware.com/vtk/vtk/-/issues/18298)**
>
> When running this script in Python, I get a segmentation fault (core dumped)

> <https://github.com/SlicerRt/SlicerRT/issues/195>
>
> SlicerRT has an outdated vtkCollisionDetectionFilter class, that is now natively… part of VTK. It would be nice to migrate it to VTK to get also the latest bug fixes and reduce maintenance effort here in SlicerRT. See e.g. https://gitlab.kitware.com/vtk/vtk/-/issues/18298
> Thanks!

[Previous page](https://discourse.slicer.org/t/collision-detection-capabilities-in-3d-slicer/14854.md?page=1)
