[vtkusers] HELP!! vtkActorCollection
marisa aurelio
asiram00 at hotmail.com
Sun Jun 29 14:30:43 EDT 2003
Hi vtkUsers,
When I do:
vtkActor *imageActor1 = vtkActor::New();
vtkActor *imageActor2 = vtkActor::New();
vtkActorCollection *imageActorCollection = vtkActorCollection::New();
// Add the first actor
imageActorCollection->AddItem(imageActor1);
// Add the second actor
imageActorCollection->AddItem(imageActor2);
When I'm adding the second actor, does it add it to the first position,
deleting the actor that was already on the list ???
Or add it to the next position, maintaining the first actor???
I'm asking this because, I've several images of whitch I want to obtain
their contour and show all the contours in the same image. The problem is
that I don't know how many images I have because they can be in a different
number.
So I create a list that keeps the images. Than I obtained the contour and
kept it in a vtkActor which I add to vtkActorCollection. For this I use a
cicle 'for', that do this for all the images:
vtkMarchingSquares *imageSquares = vtkMarchingSquares::New();
vtkPolyDataMapper *imageMapper = vtkPolyDataMapper::New();
for(int i = 0; i < ImageNumber; i++)
{
// some code...............
//vtkImporter - contain the image
imageSquares->SetInput(vtkImporter->GetOutput());
imageSquares->SetValue(0,63);
imageSquares->Update();
vtkPolyData *maskMesh = imageSquares->GetOutput();
imageMapper->SetInput(maskMesh );
imageMapper->ScalarVisibilityOff();
imageActor->SetMapper(imageMapper);
imageActorCollection->AddItem(imageActor);
}
But, when I ask to show the contours it just shows the contour of the last
image from the list.
vtkRenderer* renderer = vtkRenderer::New();
vtkRenderWindow* renWin = vtkRenderWindow::New();
imageActorCollection ->InitTraversal();
while (imageActor = imageActorCollection ->GetNextActor())
{
renderer->AddActor(imageActor);
}
renWin->AddRenderer(renderer);
Why???
Thanks in advance,
Marisa
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
More information about the vtkusers
mailing list