[vtkusers] Generating Mesh from Contour Data?

Ashika Umanga Umagiliya aumanga at biggjapan.com
Mon Oct 4 21:43:48 EDT 2010


Thanks Bill for the help,

I have another question.
My contours have more than one curves.

Please refer to this image at:

http://oi55.tinypic.com/p204h.jpg

How can I arrange these curves in polydata? Shall I create PolyData for 
each curve and add to vtkAppendPolyData ? So there PolyData will have 
same Z value.

Any tips?

Thanks in advance.



Bill Lorensen wrote:
> You should look at:
>  	 vtkVoxelContoursToSurfaceFilter
> described here:
> http://www.vtk.org/doc/nightly/html/classvtkVoxelContoursToSurfaceFilter.html
>
>
> Here is an example:
> http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ContoursToSurface
>
>
> On Mon, Oct 4, 2010 at 5:38 AM, Ashika Umanga Umagiliya
> <aumanga at biggjapan.com> wrote:
>   
>> Greetings all,
>>
>> I refered the post below on this topic ,
>>
>> http://vtk.1045678.n5.nabble.com/Creating-a-3D-surface-mesh-from-a-stack-of-contours-td1245753.html
>>
>> In the solution given below , I don't understand the variable "input_image"
>> (which i assume of type vtkImageData).
>> Is it the volume-data which is used to extract contours? Can't I generate
>> mesh only using contours  without this image data?
>>
>>
>> vtkAppendPolyData * app = vtkAppendPolyData::New();
>>
>> for (std::vector<vtkPolyData*>::iterator i = roi.contours.begin(); i !=
>> roi.contours.end(); i++)
>>         app->AddInput(*i);
>>
>>     vtkPolyDataWriter* w=vtkPolyDataWriter::New();
>>     vtkLinearExtrusionFilter * extrude=vtkLinearExtrusionFilter::New();
>>     extrude->SetInput(app->GetOutput());
>>     extrude->SetVector(0, 0, 3);  //3 is the Z spacing between contours
>>     extrude->CappingOn();
>>     extrude->Update();
>>
>>     vtkPolyDataToImageStencil* sts=vtkPolyDataToImageStencil::New();
>>     vtkImageStencil* stencil=vtkImageStencil::New();
>>     sts->SetInput(extrude->GetOutput());
>>     sts->SetInformationInput(input_image);   /////****** What is this
>> input_image ?
>>     sts->Update();
>>     stencil->SetStencil(sts->GetOutput());
>>     stencil->SetInput(input_image);
>>
>>     vtkSmartPointer<vtkMarchingCubes> marching =
>> vtkSmartPointer<vtkMarchingCubes>::New();
>>     marching->SetInput(stencil->GetOutput());
>>     marching->SetValue(0,0.5);
>>     marching->Update();
>>
>>
>>
>> Thanks in advance.
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>     




More information about the vtkusers mailing list