[vtkusers] How to add scalar data in a custom reader?

shenyanwen shenyanwen at gmail.com
Mon Mar 30 22:07:37 EDT 2009


Hello! I just read the reference of VTK5.2, and I foud that there are no
Allocate() method in the class of vtkDoubleArray or vtkIntArray. And can I
use the InsertValue instead of InsertNextValue if I specify the actual point
ID?
Can I use it like this:

vtkIntArray *castkey = vtkIntArray::New();
    castkey->SetName("cast_type");
    castkey->Allocate(numPts);   // Allocate the memory
    for (int i=0; i<L; i++) for (int j=0;j<M; j++)    for (int k=0; k<N;
k++)
    {
        int idx = i*M*N+j*N+k;
        castkey->InsertValue(idx, sgn.GetData()[idx] );
    }
    output->GetPointData()->AddArray(castkey);


-- 
shenyanwen at gmail.com
Mobile Phone:13476177952
Tel: 027-87558144
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090331/1f5eddf7/attachment.htm>


More information about the vtkusers mailing list