[vtkusers] help needed with vtkprobefilter

Kamran Iranpour kamran.iranpour at gmail.com
Thu Feb 5 07:27:09 EST 2009


Hi,
Let me first confess to lack of experience in and knowledge of vtk.
Still, having failed to find any answer to my problem after browsing
the archive and extensive search in the documentation I allow myself
to seek your help:

I have a cube that needs resampling and I thought vtkprobefilter would
offer the solution I was looking for. Here is the piece of code I
struggle with:

--------------------------------------------------------------------
...
...
  for (int i = 0; i < znodes; i ++)
	  for (int j = 0; j < ynodes; j ++)
		  for (int k = 0; k < xnodes; k ++) {
	       zValues->InsertValue(nPoints, cubeData[cubeindex]);
	       cubeindex++;
  }
  vtkImageData* imageData = vtkImageData::New();
  vtkImageData* mapData = vtkImageData::New();
  vtkProbeFilter* probeFilter = vtkProbeFilter::New();
  imageData->SetDimensions(xnodes, ynodes, znodes);
  imageData->SetOrigin(xo, yo, zo);
  imageData->SetSpacing(xIncrement, yIncrement, zIncrement);
  imageData->GetPointData()->SetScalars(zValues);

  mapData->SetDimensions(xnodes, ynodes, znodes);
  mapData->SetOrigin(xo, yo, zo);
  mapData->SetSpacing(xIncrement, yIncrement, zIncrement);

  probeFilter->SetSource(imageData);
  probeFilter->SetInput(mapData);
  probeFilter->Update();
  mapData->GetPointData()->SetScalars(probeFilter->GetOutput()->GetPointData()->GetScalars());
...
...
-----------------------------------------------------------------------------

As you see I am using the same cube geometry for input as well as the
output to see if it works in the simplest case.

The problem is when I make the call to "Update()". The program
crashes. The strange thing is that it occasonally works for small
cubes (around 100x100x100) making me wonder if there is a limit to the
number of smaples since memory should not be the problem as I have
enough memory to make every programmer green with envy. Or am I way of
the mark in the above code ?

Any help would be greatly appreciated,

Kamran



More information about the vtkusers mailing list