[vtkusers] set StructuredPoints scalars

Lista de vtk vtk at helios.tel.uva.es
Sun Nov 18 06:44:45 EST 2001


Hi vtkusers!

I am using vtkScalars to try to set the values of a vtkStructuredPoints:


  vtkStructuredPoints *output;
  vtkPointData *outpd;
  vtkScalars *outEscalares;
  unsigned short *puntOut;
  
  output = (vtkStructuredPoints *)this->GetOutput();
  output->SetDimensions(datos->GetDimensions());
  outpd = output->GetPointData();
  outEscalares = vtkScalars::New(VTK_UNSIGNED_SHORT);
  outpd->SetScalars(outEscalares);
  
  outEscalares->SetNumberOfScalars( datos->GetNumberOfPoints() );
  outEscalares->Allocate( datos->GetNumberOfPoints() );
  puntOut = (unsigned short *)( (vtkUnsignedLongArray *)outEscalares-> GetData())->GetPointer(0);


but this seems to be working only when i declare the scalars as float:

float *puntOut;
(...)    
outEscalares = vtkScalars::New(VTK_FLOAT);                                                             
(...)
puntOut = (float  *)( (vtkUnsignedLongArray *)outEscalares-> GetData())->GetPointer(0);


Otherwise the output StructuredPoints don't take the values i set...

Can anyone help me with this?

thanks.



                  Diego




More information about the vtkusers mailing list