[vtkusers] Just trying to draw a simple volume and need help.
Alex Lear
alear at cns.montana.edu
Tue Nov 5 16:54:45 EST 2002
I know someone out there can help because this should be so simple. I am
trying to view my 3d point data (100x100x100) as a volume. Since I have
upgraded to vtk 4.0 my biggest problem is switching from vtkScalars to
vtkDataArray. This is what I am doing now to test and the problem is below:
**************************************************************************
vtkUnsignedCharArray *Scalars = vtkUnsignedCharArray::New();
Scalars->SetNumberOfValues (1000000);
for (i=0;i<1000000;i++)
{
Scalars->InsertNextValue(128);
}
vtkStructuredPoints *sPoints = vtkStructuredPoints::New();
sPoints->SetDimensions(100,100,100);
sPoints->GetPointData()->SetScalars(Scalars));
**************************************************************************
The real problem is here, the scalars are still set at 0 instead of 128 after
the SetScalars function. I have adjusted my opacity transfer function and
found out that all the values are 0. I have tried to trim this example down
to just the necessary parts in question. I have used unsigned chars in this
example but I would like to get floats working also. The only examples I can
find still use the old vtkScalars unfortunately.
Like I said before, this should be easy which is the most frustrating part.
I welcome any help you can give. Even code chucks from a working program
would be of help. Thanks so much!
Alex
More information about the vtkusers
mailing list