Discussion:
[mitk-users] using mitkRotationOperation
Wojciech Lassmann
2017-02-26 23:20:44 UTC
Permalink
Hi, i have problem.
I want to rotate the mitkWidget4 cotents arround 3 perpendicular vectors
(that would rotate with the world)
I allready know that VTK functions are not much of a help, as they rotate
around static axis, And i want to try with mitkRotationOperation, but seems
thet i dont understand it.

i use qt slider moved signal to trigger the slot, and read its position

qDebug() <<QString(position); //to check if is propperly trigered

// typedef mitk::Vector<ScalarType, 3> Vector3D;
mitk::Vector3D vector = mitk::Vector3D();
vector[0]=0.0;
vector[0]=1.0;
vector[0]=0.0;

mitk::RotationOperation* op = new mitk::RotationOperation(1, //i dont
actually know what does tis fo as it just an int, what value should it have
geo->GetCenterInWorld(), //where geo is time geometry of the data storage
initialising the views
vector,
(double)position); //which is the slider value
geo->ExecuteOperation(op);
ui->view2->mitkWidget4->update(); //where view2 is my temorary name for
QmitkStdMultiWidget

This doesn't seem to do anything, and I have no Idea why.

(http://docs.mitk.org/2015.05/GeometryOverviewPage.html
*geometry->GetVtkMatrix()->Rotate()
*mentioned at the end of the page doesn't seem to exist anymore)

With Regards,
Wojciech Lassmann
Albert Alises
2017-02-28 12:35:39 UTC
Permalink
Hello Wojciech,

The mitk Rotation Operation works as follows:

The first parameter indicates which operation do you want to perform, in
our case the rotation, so the first parameter is *mitk::OpROTATE* instead
of 1. The second parameter indicates the point to rotate around. by setting
it to *geo->GetCenterInWorld() *, you are rotating around the center of
your view, which is correct based on your goals. The third and four
parameters refer to the vector of rotation and angle of rotation,
respectively. That is, they represent a rotation in *Axis-Angle *form.

In your case, you are rotating an angle given by *position *(MITK treats
them as non radian angles), *around the axis* defined by vector (in your
case, (0,1,0), but note that you assigned the position 0 of the vector 3
times! instead of: mitk::Vector3D vector = mitk::Vector3D();
vector[0]=0.0;
vector[1]=1.0;
vector[2]=0.0;)

Once defined this operation, you apply it to your geometry such as:



* geo->ExecuteOperation(op);*
And update the geometry. Try defining the rotation with the parameters
mentioned above and also render again using *this->RequestRenderWindowUpdate
*and see if it works.

Cheers,
Post by Wojciech Lassmann
Hi, i have problem.
I want to rotate the mitkWidget4 cotents arround 3 perpendicular vectors
(that would rotate with the world)
I allready know that VTK functions are not much of a help, as they rotate
around static axis, And i want to try with mitkRotationOperation, but seems
thet i dont understand it.
i use qt slider moved signal to trigger the slot, and read its position
qDebug() <<QString(position); //to check if is propperly trigered
// typedef mitk::Vector<ScalarType, 3> Vector3D;
mitk::Vector3D vector = mitk::Vector3D();
vector[0]=0.0;
vector[0]=1.0;
vector[0]=0.0;
mitk::RotationOperation* op = new mitk::RotationOperation(1, //i dont
actually know what does tis fo as it just an int, what value should it have
geo->GetCenterInWorld(), //where geo is time geometry of the data storage
initialising the views
vector,
(double)position); //which is the slider value
geo->ExecuteOperation(op);
ui->view2->mitkWidget4->update(); //where view2 is my temorary name
for QmitkStdMultiWidget
This doesn't seem to do anything, and I have no Idea why.
(http://docs.mitk.org/2015.05/GeometryOverviewPage.html *geometry->GetVtkMatrix()->Rotate()
*mentioned at the end of the page doesn't seem to exist anymore)
With Regards,
Wojciech Lassmann
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
https://lists.sourceforge.net/lists/listinfo/mitk-users
Loading...