[vtkusers] Generate meshes for contour data which have several curves in one contour?

Ashika Umanga Umagiliya aumanga at biggjapan.com
Wed Oct 6 06:13:59 EDT 2010


Greetings ,

I generated seperate meshes for each curve-set and the result looks like
this:

http://oi56.tinypic.com/b9ch82.jpg

As can be seen in the picute,they have lots the relative positions.

Any tips whould be greatly appretiated.

Here is my code :


       QList<vtkAppendPolyData*> *collection=constCurvePolyDataSets();
//get list of curve-sets


for(int i=0;i<collection->size();i++)
{
vtkAppendPolyData *appPoly=collection->at(i); //Generate mesh for each Curve
set

qDebug("PolyData %d %d",i,appPoly);
double bc[6], bm[6];
appPoly->GetOutput()->GetBounds(bc);

vtkActor *actor = vtkActor::New(); //New actor for each mesh part
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 vtkVoxelContoursToSurfaceFilter *contoursToSurface
=vtkVoxelContoursToSurfaceFilter::New();
contoursToSurface->SetInputConnection(appPoly->GetOutputPort());
contoursToSurface->SetSpacing(5, 5, 1);
 contoursToSurface->Update();
contoursToSurface->GetOutput()->GetBounds(bm);
qDebug("C - %d %d %d %d %d %d "  ,bc[0],bc[1],bc[2],bc[3],bc[4],bc[5]);
qDebug("M - %d %d %d %d %d %d "  ,bm[0],bm[1],bm[2],bm[3],bm[4],bm[5]);

mapper->AddInputConnection(contoursToSurface->GetOutputPort() );
mapper2->SetInputConnection(appPoly->GetOutputPort());

actor->SetMapper(mapper);
 renderer->AddActor(actor);




}


On 6 October 2010 12:07, Ashika Umanga Umagiliya <aumanga at biggjapan.com>wrote:

> Greetings all,
>
> I have stack of contours which generated using someother algorithm outside
> VTK.
> Each contour consists of several curves .
>
> Please refer to image at :
>
> http://oi52.tinypic.com/14xkobc.jpg
>
>
> As seen in the image, each curve has an ID to identify which level it
> is.(Curves in same level have identical color)
>
> Now I want to generate Meshes using "vtkVoxelContoursToSurfaceFilter" for
> each of this Curve set belong.
> That is, one mesh for contours in Blue color , another mesh for contours in
> Orange color ..and so on..
> And I should keep the relative positions of these Meshes. And should color
> each generated mesh in different color.
>
> I keep a list of  "vtkAppendPolyData"  for each Curve set.
>
> But I am not sure where I should go after this?
> 1.Shall I create seperate Actors for each Mesh ? If so how can I keep the
> relative positions of Meshes. (vtkVoxelContoursToSurfaceFilter change the
> origin right?)
> 2.Can I use vtkVoxelContoursToSurfaceFilter.SetInputConnection(int
> port,vtkAlgorithmOutput) and use different port number for each curves
> "vtkAppendPolyData".
>
> Any tips,
>
> thanks in advance,
> umanga
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101006/e48c9dc0/attachment.htm>


More information about the vtkusers mailing list