# vtkAnnotatedCubeActor transformation question

**URL:** https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271
**Category:** Support
**Created:** [September 2, 2022, 3:28am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271 "2022-09-02T03:28:31Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [September 2, 2022, 3:28am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/1 "2022-09-02T03:28:31Z")

</div>

Rotation of vtkonnotatedcubeactor does not work.Is there a mistake in my usage？I put it in vtkorientationmarkerwidget and call its rotation method.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [September 2, 2022, 8:50pm UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/2 "2022-09-02T20:50:53Z")

</div>

Hello,

Did you setup your `vtkOrientationMarkerWidget` correctly?

```cpp
    //----------------------adding the orientation axes-------------------------
    vtkSmartPointer<vtkAnnotatedCubeActor> axes = vtkSmartPointer<vtkAnnotatedCubeActor>::New();
    _vtkAxesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
    _vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
    _vtkAxesWidget->SetOrientationMarker(axes);
    _vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); //both widgets must share the same interactor.
    _vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2);
    _vtkAxesWidget->SetEnabled(1);
    _vtkAxesWidget->InteractiveOn();
    //--------------------------------------------------------------------------

```

In the code above, `_vtkwidget` is the VTK widget for your application’s GUI framework (e.g. `QVTKOpenGLNativeWidget` in applications uding Qt).

take care,

Paulo

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [September 3, 2022, 12:52am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/3 "2022-09-03T00:52:13Z")

</div>

Please look at: [vtkOrientationMarkerWidget](https://vtk.org/doc/nightly/html/classvtkOrientationMarkerWidget.html), in patricular the comment: _To use this object, there are two key steps: 1) …_

Also you can directly access several examples showing usage from there. I would recommend starting with [OrientationMarkerWidget](https://kitware.github.io/vtk-examples/site/Cxx/Widgets/OrientationMarkerWidget/)

---

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [September 4, 2022, 7:01am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/4 "2022-09-04T07:01:20Z")

</div>

Hello，The code is the same as yours, but axes. RotateY () does not work

---

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [September 4, 2022, 7:12am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/5 "2022-09-04T07:12:05Z")

</div>

In fact, I want to perform matrix transformation on it to ensure that the orientation of volume data in different directions is the same.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [September 4, 2022, 12:51pm UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/6 "2022-09-04T12:51:33Z")

</div>

Hello,

“Does not work” is like saying your entire body hurts to the doctor 🙃 . Can you, please, be more specific? Nothing happens? The volume disappears? The volume is distorted? The volume gets cut? The volume goes the wrong way? Please, describe more clearly what you get when you call `RotateY()` in your code. Preferably with the code snippet directly involved.

regards,

Paulo

---

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [September 5, 2022, 4:17am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/7 "2022-09-05T04:17:18Z")

</div>

Hello,The code is the same as what you posted. I solved my problem with another solution. Thank you very much for your reply！  
//----------------------adding the orientation axes-------------------------  
vtkSmartPointer axes = vtkSmartPointer::New();  
\_vtkAxesWidget = vtkSmartPointer::New();  
\_vtkAxesWidget-\>SetOutlineColor(0.9300, 0.5700, 0.1300);  
\_vtkAxesWidget-\>SetOrientationMarker(axes);  
\_vtkAxesWidget-\>SetInteractor(\_vtkwidget-\>renderWindow()-\>GetInteractor()); //both widgets must share the same interactor.  
\_vtkAxesWidget-\>SetViewport(0.0, 0.0, 0.2, 0.2);  
\_vtkAxesWidget-\>SetEnabled(1);  
\_vtkAxesWidget-\>InteractiveOn();

axes-\>RotateY(90);  
//--------------------------------------------------------------------------

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [September 5, 2022, 1:30pm UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/8 "2022-09-05T13:30:17Z")

</div>

So, what was your other solution? Others with the same problem as yours may benefit from it.

---

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [September 6, 2022, 1:11am UTC](https://discourse.vtk.org/t/vtkannotatedcubeactor-transformation-question/9271/9 "2022-09-06T01:11:29Z")

</div>

I use ImageData.SetDirectionMatrix() to rotate the object itself to ensure that the orientation of different objects is the same
