[vtkusers] Drawing Multiple Lines with vtkImageCanvasSource2D

Alexis Cheng acheng_1221 at hotmail.com
Thu Mar 24 19:25:42 EDT 2011


Hi all,

I'm creating an image using vtkImageCanvasSource2D and need to draw multiple lines within the image. I'm able to do this using the DrawSegment/FillTube functions. My problem is that when I try to draw multiple lines in a loop, it only displays 1 line in the final image.

//////////
vtkSmartPointer<vtkImageCanvasSource2D> imageLine = vtkSmartPointer<vtkImageCanvasSource2D>::New();
imageLine->SetScalarTypeToUnsignedChar();
imageLine->SetExtent(MTImage->GetExtent());
imageLine->SetNumberOfScalarComponents(1);
imageLine->SetDrawColor(0,255,0);

for (int i = 0; i < EP1Vector2Dx.size(); i++)
{
        imageLine->FillTube(*EP1Vector2Dx.at(i),960 - *EP1Vector2Dy.at(i), *EP2Vector2Dx.at(i), 960 - *EP2Vector2Dy.at(i),1);
}
imageLine->Update();
//////////

This for loop will only create a single line. Note that it will draw multiple lines if I expand the for loop into individual statements. I think I'm misunderstanding how the pipelines work. Is there a way to implement a for loop within the pipeline? Thank you all in advance.

Regards,
Alexis Cheng
Electrical Engineering
University of British Columbia
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110324/0037dd47/attachment.htm>


More information about the vtkusers mailing list