[vtkusers] extract pixels

Marcelo Costa Oliveira marcelo at cci.fmrp.usp.br
Mon Jun 25 08:56:52 EDT 2001


Hi, users

I'm from Brazil and beginning with vtk.

How I can extract pixels within the polygon from image.  would like that
you see  my pipeline
that doesn't work   : 0 (        ( vtkCutter can work with a Tif ? ) .


vtkTIFFReader *reader =  vtkTIFFReader :: New();

    reader -> SetFileName("/home/marcelo/vtk/vtk.tif");

    //reader -> Update();

/*
vtkDataSetMapper *readerMap = vtkDataSetMapper :: New();

   readerMap -> ScalarVisibilityOn();

   readerMap -> SetInput (reader -> GetOutput());

   readerMap -> Update();

   reader -> SetScalarRange (readerMap -> GetOutput() ->
GetScalarRange());


 vtkActor *readerActor = vtkActor :: New();

    readerActor -> SetMapper (readerMap);



 vtkPoints *selectionPoints = vtkPoints :: New();

    selectionPoints -> InsertPoint (0, 0.5, 0.5, 0.0);
    selectionPoints -> InsertPoint (1, 0.5, 0.8, 0.0);
    selectionPoints -> InsertPoint (2, 0.8, 0.5, 0.0);
    selectionPoints -> InsertPoint (3, 0.8, 0.8, 0.0);


 vtkImplicitSelectionLoop *loop = vtkImplicitSelectionLoop :: New();

    loop -> SetLoop (selectionPoints);

    loop -> SetNormal(1, 1, 1);

*/


/*
 vtkPlane *plane = vtkPlane :: New();

    plane -> SetOrigin (0.5,0.5,0);

    plane -> SetNormal (1,1,1);

*/

 vtkCutter *cutter = vtkCutter :: New();

    cutter -> SetInput (reader -> GetOutput());

    cutter -> SetCutFunction (sphere1);

 vtkPolyDataMapper *cutMapper = vtkPolyDataMapper :: New();

     cutMapper -> SetInput (cutter -> GetOutput());

     cutMapper -> Update();

 vtkActor *actor = vtkActor :: New();

    actor -> SetMapper (cutMapper);

//***************************************************************************

 vtkPolyDataWriter *writer = vtkPolyDataWriter :: New();

    writer -> SetInput (cutter -> GetOutput());

    writer -> SetFileName ("teste3.vtk");

    writer -> SetFileTypeToBinary ();

    writer -> Write();
//**************************************************************************


 vtkRenderer *ren1 = vtkRenderer :: New();


 vtkRenderWindow *renWin = vtkRenderWindow :: New();

    renWin -> AddRenderer (ren1);

 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor :: New();

    iren -> SetRenderWindow (renWin);

 ren1 -> AddActor (actor);






More information about the vtkusers mailing list