[vtkusers] scale and rotation
Lisa Sobierajski Avila
lisa.avila at kitware.com
Mon Jul 10 09:56:52 EDT 2000
Hello Emmanuelle,
Two notes on your script:
Volume->RequiresRayCasting();
You should not make this call. It actually doesn't do anything (it returns
a value that you are ignoring) but if you look at the documentation of the
method it states that it is an internal method of the rendering process
(made public since the renderer must ask if of its props) that should not
be used outside of the rendering process.
I don't see any
Ren->GetActiveCamera->ParallelProjectionOn();
call - the VolumePro mapper behaves correctly only for parallel projections.
Other than that, I think rotating the volume should work, so there is
probably a bug. I'll look into it. In the mean time, you can rotate the
camera instead (visually will have the same effect if you don't have any
other props in your scene).
Lisa
At 11:26 AM 7/7/00, Emmanuelle Bourrat wrote:
>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.
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>vtkusers mailing list
>vtkusers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list