[vtkusers] vtkImageImport callback and events

Ali - saveez at hotmail.com
Thu Nov 2 15:15:18 EST 2006


Hi,

The following code tries to connect a c-array pointer to image data to a 
vtkImageImport object. I want to make sure that whenever this pointer is 
changes, the vtkImageImport is modified too.

The problem is that the callback functions are called only once. Do I need 
to add observers and events in order to have the callbacks to get called at 
the right times? The examples for connecting itk-vtk pipelines just set the 
callbacks, they do not define any events explicitly.


void* BufferPointerCallback()
{
        printf("buffer updated...\n");
	return get_updated_pointer_to_image_data();
}
void* BufferPointerCallbackFunction(void*);
void* BufferPointerCallbackFunction(void* userData)
{
    return CameraBufferPointerCallback();
}

int PipelineModifiedCallback()
{
	printf("pipeline modified...\n");
	return 1;
}
int PipelineModifiedCallbackFunction(void*);
int PipelineModifiedCallbackFunction(void* userData)
{
    return PipelineModifiedCallback();
}

main()
{
	vtkImageImport *importer = vtkImageImport::New();
        //...
        importer->SetBufferPointerCallback(&BufferPointerCallbackFunction);
	importer->SetPipelineModifiedCallback(&PipelineModifiedCallbackFunction);

        // the rest of the pipeline ending with renderer
}

_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb




More information about the vtkusers mailing list