[vtkusers] build 3D image

Koy Fish koye80 at onebox.com
Tue Jan 29 10:05:27 EST 2002


Hi...

I need to visualize 2D bmp image into 3D. I have already build the visualization
pipeline for it, but the rendered image isn't look like 3D terrain image.
Is there something missing in my code below? 
Thanks,

Regards,

Koye


The code:
void main()
{
  vtkRenderer *aren    = vtkRenderer::New();
  vtkRenderWindow *renWin  = vtkRenderWindow::New();
    renWin->AddRenderer(aren);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

  //load the image
  vtkBMPReader *reader = vtkBMPReader::New();
    reader->SetFileName("koy.bmp");

  vtkImageLuminance *luminance = vtkImageLuminance::New();
    luminance->SetInput(reader->GetOutput());

  vtkStructuredPointsGeometryFilter *geometry = vtkStructuredPointsGeometryFilter::New();
    geometry->SetInput(luminance->GetOutput());

  vtkWarpScalar * warp = vtkWarpScalar::New();
    warp->SetInput(geometry->GetOutput());
	warp->SetScaleFactor(0.1);

  vtkMergeFilter *merge = vtkMergeFilter::New();
	merge->SetGeometry(warp->GetOutput());
    merge->SetScalars(reader->GetOutput());

  vtkDataSetMapper *mapper = vtkDataSetMapper::New();
	mapper->SetInput(merge->GetOutput());
	//mapper->SetScalarRange(0 255);
	mapper->ImmediateModeRenderingOff();
  vtkActor *actor = vtkActor::New();
    actor->SetMapper(mapper);
    actor->GetProperty()->SetColor(0.8,1.0,0.9);

  aren->AddActor(actor);
  renWin->Render();
  iren->Start();
}

__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com




More information about the vtkusers mailing list