[vtkusers] question about displaying BMPs

Fred August pitoz at yahoo.com
Wed Jun 30 01:26:48 EDT 2004


Hi, 

sorry to ask such simple questions but I'm having some
trouble and am hoping that this will take very little
of your time.
I'm trying to display a BMP in a window. This should
be simple, I think. In fact I have managed to display
the BMP itself. However the image I get is very dark,
or at least way darker than the one I get by looking
at the BMP with any software package. Not sure what to
do. My current pipeline is composed by

vtkBMPReader -> vtkImageShrink3D -> vtkImageMapper ->
vtkActor2D -> vtkRenderer 

and then a Borland C++ window. I also tried
vtkRenderWindow with same effects.

thank you very very much for your help!

fred

ps - here's the code I'm using

  // load and show image
  vtkBMPReader *m_singleImage = vtkBMPReader::New();
  m_singleImage->SetFileName(".\\heart2\\slice.0");
  m_singleImage->SetDataExtent(0,479, 0, 479, 0, 0);
  float originX, originY;
  originX = m_diameter/2.0;
  originY = m_diameter/2.0;
  m_singleImage->SetDataSpacing(m_XYSpacing, 
m_XYSpacing, 0);
  m_singleImage->Update();

  // shring image data
  vtkImageShrink3D *shrinkFil =
vtkImageShrink3D::New();
  shrinkFil->SetInput(m_singleImage->GetOutput());
  shrinkFil->SetShrinkFactors(2, 2, 2);
  shrinkFil->Update();

  // map it!
  vtkImageMapper *mapIm = vtkImageMapper::New();
  mapIm->SetInput(shrinkFil->GetOutput());

  // hook it up to an actor
  vtkActor2D *actorIm = vtkActor2D::New();
  actorIm->SetMapper(mapIm);

  // render the actor
  vtkRenderer *renderer =
vtkBorlandRenderWindow1->GetRenderer();
  renderer->SetViewport(0, 0, 1, 1);
  renderer->AddActor(actorIm);
  renderer->SetBackground(1.0, 1.0, 1.0);
  vtkBorlandRenderWindow1->Repaint();




	

	
		
____________________________________________________________
Yahoo! Companion - Scarica gratis la toolbar di Ricerca di Yahoo! 
http://companion.yahoo.it



More information about the vtkusers mailing list