[vtkusers] vtkbmpreader

u liu lsenlee at yahoo.com.cn
Sat Dec 9 20:44:54 EST 2006


hi,
thanks for your answer! 
what i want to do:
        i draw a 8 bits bitmap with windows drawing tool.its total number is 13.in the bitmap ,i draw a rectangle. what i want to do is read this bitmap,and reconstruct a cuboid.
  the code :
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include"vtkImageMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkActor2D.h"
#include "vtkRenderer.h"
#include"vtkBMPReader.h"
int main()
{vtkBMPReader *cone=vtkBMPReader::New();
    cone->Allow8BitBMPOn();
 cone->SetFilePrefix("E:\\bmp1\\yu");
 cone->SetFilePattern("%s%02d.bmp");
    cone->SetDataExtent(0,379,0,260,1,29);
 cone->SetDataSpacing(1,1,3);
 cone->Update();
 vtkImageMapper   *coneMapper  =   vtkImageMapper::New();   
    coneMapper->SetInput(cone->GetOutput());   
  vtkActor2D   *coneActor  =   vtkActor2D::New();   
                            coneActor->SetMapper(coneMapper);   
  vtkRenderer *ren1= vtkRenderer::New();
  ren1->AddActor2D( coneActor );
  ren1->SetBackground( 1, 1, 1 );
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer( ren1 );
  renWin->SetSize( 300, 300 );
int i;
  for (i = 0; i < 360; ++i)
    {
    renWin->Render();
   ren1->GetActiveCamera()->Azimuth( 0.01 );
    }
  cone->Delete();
  coneMapper->Delete();
  coneActor->Delete();
  ren1->Delete();
  renWin->Delete();
 return 0;
}
  problem:
    first i use vtkPolyDataMapper and vtkActor  to mapper and actor the piictures. and it had some errors! the code can compile but not results. and now i use vtkImageMapper and vtkActor2D . the result is just a 2D picture. not a cuboid.i think it is maybe the problem that vtkImageMapper and vtkActor2D is a class which to deal with 2D, and i don`t konw which class i can use and how to use to get the result:a cuboid.can you tell what is wrong,and how can i do to get the reuslt.
maybe you will ask me what is this doing for. i just to do a test. because i get a borderline after the image segmentation,and want to reconstruct. so it is similar with this test.
  it is very kind of you for your answer.
liu

 		
---------------------------------
 Mp3疯狂搜-新歌热歌高速下   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061210/d342139b/attachment.htm>


More information about the vtkusers mailing list