[vtkusers] Volume Rendering Probs - we are stooopid

mista.tapas at gmx.net mista.tapas at gmx.net
Tue Nov 5 10:35:24 EST 2002


Hi..

We are trying to visualize a Batch of bmp Files as a Volume. Sadly it
doesn"t work.

It seems to us, that somehow th eDimensions get screwed up.. Would you
please be so kind to have a look at our source code (its short)?

Do we miss something obvious?

int main()
{
  vtkBMPReader * BMPReader = vtkBMPReader::New();
  BMPReader->SetFilePrefix("pics/final.bmp");

  // Dim of pic is 170x138.. Do we use that right?
  BMPReader->SetDataExtent(0,170,0,138,0,20);
  BMPReader->Update();

    vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();
  vtkVolumeRayCastCompositeFunction *RayCastFunction =
vtkVolumeRayCastCompositeFunction::New();
  VolumeMapper->SetVolumeRayCastFunction(RayCastFunction);
 
  VolumeMapper->SetInput(BMPReader->GetOutput());

  vtkVolume *Volume = vtkVolume::New();
  
  Volume->SetMapper(VolumeMapper);
 
  vtkColorTransferFunction *TransferFunction =
vtkColorTransferFunction::New();
  TransferFunction->AddRGBPoint(0,0,0,0);
  TransferFunction->AddRGBPoint(255,0,0,1);

  vtkVolumeProperty *VolumeProperty = vtkVolumeProperty::New();
  VolumeProperty->SetColor(TransferFunction);
  VolumeProperty->SetInterpolationTypeToLinear();
  
  vtkPiecewiseFunction *OpacityFunction = vtkPiecewiseFunction::New();
  OpacityFunction->AddPoint(0,0);
  OpacityFunction->AddPoint(255,0.3);
  
  VolumeProperty->SetScalarOpacity(OpacityFunction);
  
  Volume->SetProperty(VolumeProperty);


  vtkRenderer *ImageRenderer = vtkRenderer::New();
  ImageRenderer->AddActor(Actor2D);

  vtkRenderWindow *PlaneRenderWindow = vtkRenderWindow::New();
  vtkRenderer *PlaneRenderer = vtkRenderer::New();

  PlaneRenderer->AddVolume(Volume);
  PlaneRenderer->SetBackground(1,1,1);

  PlaneRenderWindow->AddRenderer(PlaneRenderer);
 
  vtkRenderWindowInteractor *PlaneInteractor =
vtkRenderWindowInteractor::New();
  PlaneInteractor->SetRenderWindow(PlaneRenderWindow);
 
  PlaneRenderWindow->Render();
  PlaneInteractor->Start();
}


Thanks in Advance..

Florian Schmidt

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!




More information about the vtkusers mailing list