[vtkusers] 3D array float data

ylongwu 236459294 at qq.com
Sun Mar 11 23:59:49 EDT 2012


Greetings all,

In our application we need to show a 3D  float array (3x3x3).
for example :
{
{{1.1,2.2,3.3},               {4.4,5.5,6.6},               {7.7,8.8,9.9}},
{{12.1,22.2,32.3},          {42.4,52.5,62.6},          {72.7,82.8,92.9}}
{{1333.1,2333.2,3333.3},{4333.4,5333.5,6333.6}, {7333.7,8333.8,9333.9}}
}
In the "Vtk Users Guide" I came across following  example to create
vtkImageData.

vtkImageData *id=vtkImageData::New();
id->SetDimentions(3,3,3);
id->SetScalarTypeToFloat();// Float
id->SetNumberOfScalarComponents(1);// How should I set this parameter?
id->AllocateScalars();

//Fill in scalar values
float *a=(float*)id->GetScalarPointer();
for(int i=0;i<27;i++)
{
 *a++=i;
}

Am i right?   thanks!

--
View this message in context: http://vtk.1045678.n5.nabble.com/3D-array-float-data-tp5556559p5556559.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list