# Is it possible to move and rotate a model in 3d view and get the transformtion matrix?

**URL:** <https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923>\
**Category:** Support\
**Tags:** slicerigt\
**Created:** [May 5, 2024, 1:09am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923 "2024-05-05T01:09:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 5, 2024, 1:09am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/1 "2024-05-05T01:09:26Z")

</div>

I can change the transformation matrix to make a model moves in 3d view.  
But how can I do the opposite that move and rotate a model in 3d view and get its transformation matrix?  
Any method or suggestion?  
Thanks.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 5, 2024, 12:13pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/2 "2024-05-05T12:13:21Z")

</div>

[https://slicer.readthedocs.io/en/latest/user\_guide/modules/transforms.html](https://slicer.readthedocs.io/en/latest/user_guide/modules/transforms.html)

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 6, 2024, 12:01am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/3 "2024-05-06T00:01:24Z")

</div>

Thank you pieper.  
But I can’t understand.  
In fact, the key of my problem is how I can move a model directly in the 3D view,not in the transformation panel.  
Perhapes, it need a widget?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [May 6, 2024, 12:17am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/4 "2024-05-06T00:17:50Z")

</div>

> [@tdchen](#):
>
> how I can move a model directly in the 3D view,

What do you mean by that? You can use the mouse clicks to rotate/translate a model in 3D view. But that only changes the angle camera is seeing the model. If you want to modify its orientation, you need to use the transforms module.

---

<div class="post-metadata">

**Author:** ![Davide\_Scorza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/davide_scorza/32/70057_2.png) [@Davide\_Scorza](https://discourse.slicer.org/u/Davide_Scorza)\
**Post date:** [May 6, 2024, 6:59am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/5 "2024-05-06T06:59:16Z")

</div>

I think there’s no such feature available at the moment.  
If I understood correctly, you would like to interact with the module similarly as you do with a markup list.

We achieve a similar behaviour with some custom models (e.g. screws), by reusing a set of slicer nodes (markuplist, model\_nodes and tranformnodes), programming a custom object class (it requires a bit of programming).  
We use a two-point markup list, aligned with the main direction of the model that we want to interact with, and linked the “markup modified event” to recompute a transform that is then applied automatically to the model node, any time one of the markups is updated.

It is a workaround for a similar behaviour I guess you want to achieve, but it requires to program that part.

Davide

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 7:28am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/6 "2024-05-08T07:28:57Z")

</div>

Thank you muratmaga  
Yes, I can change orientation of models with transform module. But it is uneasy to control. I want to design a cutting position with mouse in 3d view, and get the corresponding transform.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 8:05am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/7 "2024-05-08T08:05:05Z")

</div>

You understand me, Davide\_Scorza.  
I really want to know if there is an available module to do it.  
Now that you’ve told me, I’m ready to program.  
Sorry for my poor English.

---

<div class="post-metadata">

**Author:** ![philippepellerin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/philippepellerin/32/16062_2.png) [@philippepellerin](https://discourse.slicer.org/u/philippepellerin)\
**Post date:** [May 8, 2024, 8:57am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/8 "2024-05-08T08:57:07Z")

</div>

I never find a way to do that easily with slicer, so I use to do a reslicing with the 3D MPR(multi planar rendering) tool in Horos, export the new set then import this volume to slicer, which give you the volume and the .h5 file which is the transform, you can just aply or harden, as you wish

---

<div class="post-metadata">

**Author:** ![emmawilson](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/emmawilson/32/70335_2.png) [@emmawilson](https://discourse.slicer.org/u/emmawilson)\
**Post date:** [May 8, 2024, 9:18am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/9 "2024-05-08T09:18:38Z")

</div>

Hello tdchen,  
As per my knowledge, To extract a transformation matrix from a 3D model’s movement and rotation, track applied transformations programmatically or use 3D graphics libraries. In code, maintain variables for translation and rotation, composing them into a final matrix. In addition, leverage libraries with functions for model manipulation and matrix retrieval. Some 3D software offer APIs for direct access to transformation data. Choose the method based on project needs and development environment, ensuring efficiency and accuracy in representing the model’s position and orientation.

I hope this will help you.

Thanks  
Emma wilson

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [May 8, 2024, 10:04am UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/10 "2024-05-08T10:04:05Z")

</div>

If I understand correctly what you’d like to do, here are the steps:

1. Turn on interactive transform for the model in the Data module (right click the eye not the name)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/8/28f7d9f414a39fba0f293e6aff44849a5398e98f.png)

2. Transform the model using the controls  

3. See the matrix in the Transforms module  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/3/83aa88bbb6bd94c3199917d049806e839d72431c.png)

You’ll need a recent 5.7 preview version to be able to access the new transform interactions.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 1:55pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/11 "2024-05-08T13:55:01Z")

</div>

Yes, philippepellerin. We have plan that export data to other software and get the transformation.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 2:10pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/12 "2024-05-08T14:10:02Z")

</div>

Thanks for your suggestion, emmawilson.  
I think Slicer must have the ability to realize your plan, and I need to find it.

---

<div class="post-metadata">

**Author:** ![philippepellerin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/philippepellerin/32/16062_2.png) [@philippepellerin](https://discourse.slicer.org/u/philippepellerin)\
**Post date:** [May 8, 2024, 3:18pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/13 "2024-05-08T15:18:14Z")

</div>

Thank you for your feedback. I perfectly know this way, as well as in 2D using the interaction in the cross, which is very useful, but it is very difficult to get a new volume oriented as a series .dicom or.NRRD. It is much more convenient in Horos.  
It depend what you want to do, if it is just to oriente the 3D use the cross interaction to get the plane you want, then draw a plane, it is efficient.

 ![PastedGraphic-1.png](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/0/0014d4138263190560b3d94638cc1219ef0519b0.jpeg)

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 3:59pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/14 "2024-05-08T15:59:04Z")

</div>

Great! That is what I want!  
It appears in the document now.  
But how did you find it？ I have never installed the beta version.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [May 8, 2024, 4:07pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/15 "2024-05-08T16:07:53Z")

</div>

> [@tdchen](#):
>
> But how did you find it？ I have never installed the beta version.

Download the preview version from [https://download.slicer.org/](https://download.slicer.org/)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/1/f18bafcb4a625315ab2d74d3d5d2f94918e7dccb.png)

> [@philippepellerin](#):
>
> I perfectly know this way, as well as in 2D using the interaction in the cross

That is a different function. Look at my screenshots please and you’ll see.

---

<div class="post-metadata">

**Author:** ![philippepellerin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/philippepellerin/32/16062_2.png) [@philippepellerin](https://discourse.slicer.org/u/philippepellerin)\
**Post date:** [May 8, 2024, 4:27pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/16 "2024-05-08T16:27:19Z")

</div>

I am running 5.7.0, easily found; let me know if you have any problems. Are you specifically interested in drawing a reference plane? I can make a tutorial if you want.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 4:29pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/17 "2024-05-08T16:29:54Z")

</div>

Thank you cpinter.  
I was using the stable version 5.2, and I found out it already have this feature, which I never noticed.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 4:35pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/18 "2024-05-08T16:35:01Z")

</div>

Thank you philippepellerin  
Let me try it first and contact you if I have any questions.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 5:07pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/19 "2024-05-08T17:07:16Z")

</div>

Now, I understand what you told me.  
Thanks.

---

<div class="post-metadata">

**Author:** ![tdchen](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.slicer.org/u/tdchen)\
**Post date:** [May 8, 2024, 5:11pm UTC](https://discourse.slicer.org/t/is-it-possible-to-move-and-rotate-a-model-in-3d-view-and-get-the-transformtion-matrix/35923/20 "2024-05-08T17:11:25Z")

</div>

You are right, muratmaga.  
I should read the document carefully.  
It is not a problem in slicer.
