[vtkusers] question about displaying BMPs

Emiliano Beronich emiliano at veccsa.com
Wed Jun 30 10:30:13 EDT 2004


Hi Fred,
try adding the following lines:

  mapIm->SetColorLevel(128);
  mapIm->SetColorWindow(256);

Regards,
Emiliano


Fred August wrote:
> 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
> _______________________________________________
> 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://www.vtk.org/mailman/listinfo/vtkusers
> 
> 



More information about the vtkusers mailing list