I want to change the center of rotation of a 3d model(stl). I would like to rotate it in his own center of rotation (In the middle of the object). Because now I only can rotate it with a rotation around the 0.0 ax.
Thanks for your answers and help
Sorry I don’t understand the process.Shall I paste the script somewhere (in the code section?) I can’t rotate around a center of rotation I’d like to choose. thanks
Yes, you can paste the code in the Python console (which can be opened/hidden by pressing Ctrl-3). This area is a command prompt for an interactive python session in Slicer’s python environment. Many scripts in the script repository will work without modification when pasted directly to the python console, however this one will need a little bit of editing by you before pasting, and a little bit of pre-work before you run it.
First you need to create a markups point where you want the center of rotation to be. If this is the first markups point you have created and you have not specified a name, the default name will be “F”. If the name of the markups node is not “F”, you need to change the second line of the script so that the name in getNode() matches the name of your markups node.
Next you need to create two transform nodes, one which will serve as your rotation
controller, and one which will be automatically updated to represent rotation around your chosen center rather than around the origin. You can create linear transform nodes in the Transforms module. You need to make a note of the names of the transforms you create and change lines 4 and 6 of the script to contain those names in the getNode() calls.
Then you are ready to paste the modified script (the whole thing at once) into the python console, which will run it. Any modifications to the rotation controller transform will automatically result in modifications to the other transform such that it represents the same rotation, but around your chosen center instead of around the origin.
Next, you need to add the automatically updating transform as the parent transform to whatever you want to be rotating. There are many ways to do this in Slicer. You can use the Transforms module or the Transform hierarchy tab of the Data module, but the simplest is to use the Subject hierarchy tab of the Data module. Find the object you want to rotate on the list, and then look to the right, there will be a small icon which looks like two rotated grids. Right click on that and then select the name of the automatically updating transform.
Finally, you can go to the Transforms module, select the rotation controller transform, and move the sliders in the “Rotation” section. All objects with the automatically updating transform as the parent transform will now be rotated around your chosen center point. That center point can also be interactively moved as desired.
FYI, @Sunderlandkyl is working on a new transform widget that will allow rotation around a chosen point (and translation along object or world axes) in both 2D and 3D views. The first version of the feature may be available in the Slicer Preview Release within a couple of weeks.
I have placed a fiducial marker at the center of a MRI volume and can successfully run the script to rotate about the center. Now I want to translate the whole volume along the IS (z) axis. Is there a way to keep the marker at the center of the volume and rotate about this new position?
In current Slicer Preview Release you can set the center of rotation for the transformation. Visually in a 2D/3D editor, or as center of a node, or by entering coordinates in the Transforms module, or using Python scripting setting the center in the transform node.