[vtkusers] Extracting algorithm outputs without rendering

Kevin H. Hobbs hobbsk at ohiou.edu
Wed Jun 7 08:24:39 EDT 2006


On Wed, 2006-06-07 at 10:38 +0200, Janko Jerinic wrote:
> Hi,
>  
> I'm new to VTK, and I was wondering how I could get the geometric data
> from an algorithm's output without rendering anything. Say, for
> example I want to do a CDT (Constrained Delaunay Triangulation) over a
> set of points and constraint polylines. I make a vtkPolyData object,
> fill it, set is as input and source of a vtkDelaunay2D instance, and
> then what?
> How do I make the algorithm run without creating filter, mapper,
> actor, renderer etc. ?
> I just want to "see" (in code) which edges/triangles are created in
> the process and have no need for visualization. OK, I need to start
> the pipeline somehow, but how do I do that?
>  
> Please help,
> Janko Jerinic
> 

Just call update on the last filter in the pipeline. For me that's
usually a writer.

#include "vtkSomeReader.h"
#include "vtkSomeFilter.h"
#include "vtkSomeWriter.h"

int main( int argc, char * argv[] )
{
	char *  in_file_name = argv[1];
	char * out_file_name = argv[2];

	// Some Reader
	vtkSomeReader * reader 
		= vtkXMLImageDataReader::New();
	reader->SetFileName( in_file_name );

	// Some Filter
	vtkSomeFilter * filter
		= vtkSomeFilter::New();
	filter->SetInputConnection
		( reader->GetOutputPort() );

	// Some Writer
	vtkSomeWriter * writer
		= vtkSomeWriter::New();
	writer->SetFileName( out_file_name );
	writer->SetInputConnection
		( filter->GetOutputPort() );

	// Update the whole pipeline.
	writer->Update();
	
	return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060607/eb5815e8/attachment.pgp>


More information about the vtkusers mailing list