# qMRMLTransformSliders

**URL:** <https://discourse.slicer.org/t/qmrmltransformsliders/29639>\
**Category:** Development\
**Created:** [May 25, 2023, 8:05am UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639 "2023-05-25T08:05:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehran](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mehran/32/11080_2.png) [@Mehran](https://discourse.slicer.org/u/Mehran)\
**Post date:** [May 25, 2023, 8:05am UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639/1 "2023-05-25T08:05:24Z")

</div>

Hi all,  
I have struggle with MRMLTransformSliders. since there are 3 sliders inside it, how we can access each slider’s value? Or if it is an attribute to extract transform matrix still is useful.  
thanks

---

<div class="post-metadata">

**Author:** ![Mehran](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mehran/32/11080_2.png) [@Mehran](https://discourse.slicer.org/u/Mehran)\
**Post date:** [May 26, 2023, 7:30am UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639/2 "2023-05-26T07:30:55Z")

</div>

I guess I need to find them in findChildren attribute as:

_import slicer_  
_from qt import QSlider_

_# Create an instance of qMRMLTransformSliders_  
_transformSliders = slicer.qMRMLTransformSliders()_

_# Find all sliders within the qMRMLTransformSliders widget_  
_sliders = transformSliders.findChildren(QSlider)_

_# Access the translation sliders_  
_translationSliders = sliders[0:3] # Assuming the translation sliders are the first three in the list_

_# Get the values of the translation sliders_  
_lrTranslation = translationSliders[0].value()_  
_paTranslation = translationSliders[1].value()_  
_isTranslation = translationSliders[2].value()_

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [May 26, 2023, 9:59am UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639/3 "2023-05-26T09:59:52Z")

</div>

I think it’s a better strategy to observe the transform node. Whenever there is a TransformModifiedEvent evoked by the transform node, you can take the transformation matrix (or vtkTransform) out of the transform node, and obtain the translation and rotation values using VTK.

---

<div class="post-metadata">

**Author:** ![Mehran](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mehran/32/11080_2.png) [@Mehran](https://discourse.slicer.org/u/Mehran)\
**Post date:** [May 26, 2023, 12:31pm UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639/4 "2023-05-26T12:31:08Z")

</div>

Thanks @ungi do you have any example for that?

---

<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 26, 2023, 1:25pm UTC](https://discourse.slicer.org/t/qmrmltransformsliders/29639/5 "2023-05-26T13:25:34Z")

</div>

You can find examples in the Slicer script repository for adding observers to nodes. In this case you need to observe the TransformModified event.
