[vtkusers] Volume Rendering Probs - we are stooopid

anast.jm at pg.com anast.jm at pg.com
Tue Nov 5 12:56:59 EST 2002


Not sure if this is your problem or not but I believe the index for the Z data
extent is not right, I think you want

BMPReader->SetDataExtent(0,169,0,137,0,20);

if you have 21 images final0 to final20

....john


                                                                
 Internet Mail Message                                          
 Received from host:      public.kitware.com                    
 [24.97.130.19]                                                 
                                                                


From: mista.tapas at gmx.net@public.kitware.com on 11/05/2002 04:35 PM CET
                                                                                             
 mista.tapas at gmx.net@public.kitware.com           To:   vtkusers at public.kitware.com          
                                                  Cc:    (bcc: John Anast-JM/PGI)            
                                          Subject:      [vtkusers] Volume Rendering Probs -  
                               Sent by:        we are stooopid                               
      vtkusers-admin at public.kitware.com                                                      
                    11/05/2002 10:35 AM                                                      
                                                                                             
                                                                                             




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!

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers






More information about the vtkusers mailing list