[vtkusers] Point number limit in vtkColorTransferFunction?

Juan José Aja Fernández juan.aja at gmail.com
Fri Feb 10 15:08:19 EST 2006


 Hi, everyone:

I need to use Volume Rendering on an unstructured grid made out of voxels,
the problem is that I have a lot of them (the grid minimum size is 50x50x50
so at least 25000 voxels).

I'm doing a truly horrible hack to try to color them:  generate a vtkPoint
for each voxel in the grid by means of

vtkDoubleArray *pts = ....

for (i=0; i < numberOf Voxels;  i++)
     pts->InsertNextValue(i);

Then I assign pts to the vtkCellData of my grid:

(grid->GetCellData())->SetScalars(pts);

And finally I populate the color transfer function.
For example if I want to color my grid like a red-green chess board, I can
do:

for (i=0; i < numberOfVoxels; i++) {
    if(i%2 == 0 && i != 0)
        ctrans->AddRGBPoint(pts->GetValue(i), 1, 0, 0);
    else ctrans->AddRGBPoint(pts->GetValue(i), 0, 1, 0);
}

The final result is very strange, the colors don't alternate the way they
are supposed to (see the attached jpgs, the first one dimensions are: 5x5x5
and it looks good, the second one 19x19x19 but the checkered pattern
dissapears).

Obviously I'm doing things wrong (the fact is that I'm somewhat new to vtk
and I don't have the slightest idea of how to accomplish this), or is there
a (short) limit in the number of points my transfer function can have?

If not, how can this be accomplished?

Thanks a lot,
Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060210/d991c333/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5x5x5.jpg
Type: image/jpeg
Size: 13373 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060210/d991c333/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 19x19x19.jpg
Type: image/jpeg
Size: 13072 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060210/d991c333/attachment-0001.jpg>


More information about the vtkusers mailing list