Changing viewpoint settings - rotation

Rotation can be set via the properties  ViewPointRotationX, ViewPointRotationY and

ViewPointRotationZ. Rotation is measured in degrees (0-360). If the viewpoint rotation setting is gradually changed while the surface window is updated, like in the loop of the scripts below, the course of the rotation will become visible.

Rotating about the X axis

When the viewpoint settings for the X axis are changed, the viewpoint direction will change with respect to the X axis. Coordinate values along the X-axis increase from left to right. Rotation of the viewpoint about this axis will cause a change in the position somewhere on the circle around the X-axis so that it looks as if the mesh is rotated forward or backward. The following functions illustrate how this can be applied via scripting.

 

function Rotate_mesh_forward_about_X_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationX;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationX = rot + 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

function Rotate_mesh_backward_about_X_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationX;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationX = rot - 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

 

initial viewpoint

 

Rotating about the Y axis

Because the y-axis runs from inferior to superior and this is the axis that will stay still when rotating about it, the mesh will appear rotated to the left or to the right when changing ViewpointRotationY. The following functions illustrate how this can be applied via scripting.

 

function Rotate_mesh_right_to_left_about_Y_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationY;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationY = rot + 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

function Rotate_mesh_left_to_right_about_Y_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationY;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationY = rot - 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

 

initial viewpoint

 

Rotating about the Z axis

The z-axis runs from posterior to anterior. Rotating about this axis has the effect that the mesh looks rotated around the clock. The following functions illustrate how this can be applied via scripting.

function Rotate_mesh_clockwise_about_Z_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationZ;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationZ = rot + 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

function Rotate_mesh_counterclockwise_about_Z_axis(){

 

 var docVMR = BrainVoyagerQX.ActiveDocument();

 var rot = docVMR.ViewpointRotationZ;

 for(i=1; i<61; i++) {

     docVMR.ViewpointRotationZ = rot - 6*i;  

     docVMR.UpdateSurfaceWindow();  

 }

}

 

 

initial viewpoint

 

Origin of coordinate system and center of mesh

The origin of the coordinate system is the center of the linked 3D data set. The mesh will rotate about this origin, about the specified axis. The origin in the surface window will usually be 128, 128, 128. If the viewpoint settings for rotation are changed, the mesh will rotate around itself because the origin and the mesh center coincide.

However, if the center of the mesh is changed (this can be performed via 'Meshes' > 'Spatial transformations', the center of rotation will still be 128, 128, 128 but the rotation circle is larger because the distance to the origin is increased (see figure below).