[vtkusers] changing the position of an actor

Steffen Oeltze Steffen.Oeltze at Student.Uni-Magdeburg.DE
Thu Oct 31 03:51:52 EST 2002

Hi David,

I still have some problem with placing my actors. I would be very 
grateful if you
could have a look at my source code below:

vtkImageChangeInformation *imgChg = vtkImageChangeInformation::New();

vtkTransform *transform = vtkTransform::New();
        transform->SetMatrix(ResultMatrix);  // matrix rotates the 
volume about 90° and reflects it on the y-axes

vtkImageReslice *imgReslice = vtkImageReslice::New();
        imgReslice->SetResliceAxesDirectionCosines(1, 0, 0,  0, 1, 0,  
0, 0, 1);


vtkActor *aPolyLineActor = vtkActor::New();

vtkAbstractTransform *trans1;
        trans1 = imgReslice->GetResliceTransform();

vtkLinearTransform *trans2 = vtkLinearTransform::SafeDownCast(trans1);
        trans2 = trans2->GetLinearInverse();


David Gobbi wrote:

>Hi Steffen,
>If you want to draw actors in the same scene as an image, it
>is crucial that you establish a coordinate system for the image.
>The image coordinate system is defined by the Origin and Spacing
>information that is attached to the image.
>When you use vtkImageChangeInformation to center the volume, you
>are modifying the 'Origin' of the image so that the origin of
>the coordinate system is at the center of the volume.  If,
>after centering the volume, you apply a transformation via
>vtkImageReslice, just set the inverse of the ResliceTransform
>as the UserTransform of the Actors.
> - David

More information about the vtkusers mailing list