[vtkusers] scale and rotation

Emmanuelle Bourrat bourrat at merl.com
Fri Jul 7 11:26:18 EDT 2000


Hi all,

I've got a rotation-scale problem.
I'm using vtk3.1 and VolumePro on windows. I want to render a volume
which spacing is 1-1-1.5. And I want to rotate it around the X axis (for
example). So this is what I'm doing:

////////////////////////////////////////////////
// Read the volume:
    vtkStructuredPointsReader *VolumeReader =
    vtkStructuredPointsReader::New();
    VolumeReader->SetFileName(VolumeName);

// Create a transfere functions for R, G, B channels:
    vtkColorTransferFunction *ColorTransferFunction =
        vtkColorTransferFunction::New();
    etc.....

// Opacity function:
 vtkPiecewiseFunction *OpacityTransferFunction =
        vtkPiecewiseFunction::New();
    etc....

 // VolumePro mapper:
 vtkVolumeProMapper *VolumeMapper = vtkVolumeProMapper::New();
 VolumeMapper->SetInput(VolumeReader->GetOutput());
 VolumeMapper->SetBlendModeToComposite();

// Volume:
 vtkVolume *Volume = vtkVolume::New();
    Volume->RequiresRayCasting();
 Volume->SetProperty(VolumeProperty);
 Volume->SetMapper(VolumeMapper);

 // Rotate the volume
 Volume->RotateX(90);

 // Renderer:
 vtkRenderer *Ren = vtkRenderer::New();
    Ren->AddVolume(Volume);
    Ren->SetBackground(0.0, 0.0, 0.0);

 // Render Window:
 vtkRenderWindow *RenWin = vtkRenderWindow::New();
    RenWin->AddRenderer(Ren);
    RenWin->SetSize(500, 500);
    vtkRenderWindowInteractor *Iren = vtkRenderWindowInteractor::New();
    Iren->SetRenderWindow(RenWin);

 // Render
 RenWin->Render();
 Iren->Initialize();
 Iren->Start();
////////////////////////////////////////////

If I don't do the rotation, my volume looks ok: it is scaled correctly.
But when I do the rotation, it seems that the scaling is applied a
second time along the z axis. So my volume looks too long along the z
direction.

Can anyone tell my how I can avoid this bad effect?

Thanks,
Emmanuelle Bourrat.





More information about the vtkusers mailing list