[vtkusers] change scalar Value in a large DataSet

Frank Decker fxd at ipa.fhg.de
Wed Oct 2 02:28:04 EDT 2002


Hi,

My Problem is, that I want to change the scalar values of a big dataset,
with the
Method SetTuple1(const vtkIdType I, float value).
After I’ve set several values (not all values, only a few) , I call the
function Modified(), so that I can see the results.
The Problem is, that the System show me the results after 1-2 seconds. It is
quite slowly, although I’ve got a very fast PC System.

Here is my Code:

CVTKRenderer::CVTKRenderer()
{
m_pRenderer = vtkRenderer::New();
m_pRenderWindow = vtkWin32OpenGLRenderWindow::New();
m_pRenderWindow->AddRenderer(m_pRenderer);
m_pInteractor = vtkWin32RenderWindowInteractor::New();
m_pWerkstueck = vtkPolyData::New();
}

void CVTKRenderer::readData()
{
 ....
 ......

vtkPoints *pPolygonPoints = vtkPoints::New();
vtkCellArray *pCellArray = vtkCellArray::New();
vtkFloatArray *pSkalarValue = vtkFloatArray::New();

	for(int i=0;i<iPktAnzahl;i++){ 	//--------------- iPktAnzahl  >27000
		//read all Points and put it in the vtkStructure
		pPunkt = &CWrk.pWrkStk[i];
		pPolygonPoints->InsertPoint(i,pPunkt->pkt);
		pSkalarValue->InsertTuple1(i,(float)pPunkt->dh);
	}
	for(i=0;i<iPolygonAnzahl;i++){ //----------- iPolygonAnzahl>55000
		pPunkt = &CWrk.pWrkStk[i];
		pts[0]=CWrk.pZord[i].n1;
		pts[1]=CWrk.pZord[i].n2;
		pts[2]=CWrk.pZord[i].n3;
		pts[3]=CWrk.pZord[i].n4;

		// --------Speichern des Polygons in eine vtk interne Struktur
		pCellArray->InsertNextCell(CWrk.pZord[0].neck,pts);

	}
	m_pWerkstueck->SetPoints(pPolygonPoints);
	m_pWerkstueck->SetPolys(pCellArray);
	m_pWerkstueck->GetPointData()->SetScalars(pSkalarValue);
	m_pWerkstueckMapper->SetInput(m_pWerkstueck);
	m_pWerkstueckActor->SetMapper(m_pWerkstueckMapper);
	m_pRenderer->AddActor(m_pWerkstueckActor);
}

void CVTKRenderer::setSkalarValue(int pointID)
{
	vtkDataArray  *pDataArray = m_pWerkstueck->GetPointData()->GetScalars();
	pDataArray->SetTuple1(pointID, CWrk.pWrkStk[pointID]);
	m_pWerkstueck->Modified();	// !!!!!!!!!this Methode returns after 1300 ms
}

Is there an other way to solve this Problem.^

Many Thanks in advance for your help

Frank Decker




More information about the vtkusers mailing list