[vtk-developers] vtkRInterface questions

Pugmire, Dave pugmire at ornl.gov
Mon Jan 23 09:41:47 EST 2012


Hi,
I'm having some issues using the vtkRInterface class.

I'm loading in an R script that was created by a statistician, and feeding it vtk data arrays for processing.
The R script defines a function, "foo()", which I then call on the vtk data array.
When I make the call, it crashes. gdb isn't catching the crash either, but putting print statements in, it's dying inside of the eval call on the embedded R API.

Here is the odd thing. If I save the state of the R session to disk, then load this file into a stand alone R, the function call will succeed. I also added it to the RTesting suite, and it runs fine. So, it's nothing to do w/ the vtkR component, it must be in what I'm doing.
Any ideas on this sort of thing?

Here is some code on what I'm doing:


vtkRInterface *RI = vtkRInterface::New();
RI->EvalRScript("source('file.q')\n");
RI->AssignVTKDataArrayToRVariable("input", input);
RI->EvalRScript("save.image(file='state.RData')\n");

RI->EvalRscript("result = foo(input)\n");

RI->AssignRVariableToVTKDataArray("result", result);


This will fail inside the 
RI->EvalRscript("result = foo(input)\n");


However, if I load state.RData into an R session, I can call: result = foo(input), and it will succeed.

One note: calling foo() will generate warnings (an iterative method is having trouble converging). Running R at the console prints a message that warnings were issued.
I wonder if these might causing some heartburn inside the R/VTK?

Thanks for any insight, suggestions you might have.

Dave



More information about the vtk-developers mailing list