[vtkusers] volume rendering preventing SetSpacing from working

Esra Neufeld neufeld at itis.ethz.ch
Thu Nov 6 11:17:30 EST 2008


Dear all,

I am quite new to vtk. I am using a vtkWidget (vtk 5.2 cvs ~ one month 
ago) in a QT3.3 environment.
The widget displays a bounding box and a volume-rendering. The problem I 
have is that when a slicethickness update function (s. below) is called, 
the bounding box is resized while the volume-rendering is not. And as 
soon as I rotate the view or redraw the widget, the bounding box is 
reset to its initial extent again.

Everything is created as follows:

  outlineGrid= vtkSmartPointer<vtkOutlineFilter>::New();
  outlineGrid->SetInput( input );
  outlineGrid->Update();
  outlineMapper= vtkSmartPointer<vtkPolyDataMapper>::New();
  outlineMapper->SetInput(outlineGrid->GetOutput());
  outlineActor= vtkSmartPointer<vtkActor>::New();
  outlineActor->SetMapper(outlineMapper);

  compositeFunction = 
vtkSmartPointer<vtkVolumeRayCastCompositeFunction>::New();
  volumeMapper = vtkSmartPointer<vtkVolumeRayCastMapper>::New();
  volumeMapper->SetVolumeRayCastFunction(compositeFunction);
  volumeMapper->SetInput(input);

  volume = vtkSmartPointer<vtkVolume>::New();
  volume->SetMapper(volumeMapper);
 
  ren3D= vtkSmartPointer<vtkRenderer>::New();
  ren3D->AddVolume(volume);
  ren3D->AddActor( outlineActor );
 
  renWin= vtkSmartPointer<vtkRenderWindow>::New();
  renWin->AddRenderer( ren3D );

When the slicethickness changes I call the following slicethickness 
update code:

void updatethick(double thick) {
    Pair p=hand3D->get_pixelsize();
    input->SetSpacing(p.high,p.low,thick);
    input->Modified();

    /*volumeMapper->SetInput(input);
    volumeMapper->Update();
    volume->SetMapper(volumeMapper);
    volume->Update();

    ren3D->Modified();*/

    vtkWidget->GetRenderWindow()->Render();
}

The problem I have is that when this slicethickness update function is 
called, the bounding box is resized while the volume-rendering is not. 
And as soon as I rotate the view or redraw the widget, the bounding box 
is reset to its initial extent again. The code commented out did not help.

What am I doing wrong?

Thank you in advance for your help

esra neufeld




More information about the vtkusers mailing list