Update: Point number limit in vtkColorTransferFunction?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Update: Point number limit in vtkColorTransferFunction?

Juan José Aja Fernández
Sorry for the double post, apparently the vtkusers mailing system only admits text only messages.

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())->SetScala
rs(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 in the previous mail., the first one dimensions are: 5x5x5 and it looks good http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/5x5x5.jpg
the second one 19x19x19 but the checkered pattern dissapears: http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/19x19x19.jpg).

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

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Update: Point number limit in vtkColorTransferFunction?

Randall Hand
I ran into a similar goof a while back, reported here : http://www.vtk.org/Bug/bug.php?op=show&bugid=2546&pos=3

That's since been fixed in VTK5.0. What version are you using?

On 2/10/06, Juan José Aja Fernández <[hidden email]> wrote:
Sorry for the double post, apparently the vtkusers mailing system only admits text only messages.

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())->SetScala
rs(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 in the previous mail., the first one dimensions are: 5x5x5 and it looks good <a href="http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/5x5x5.jpg" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/5x5x5.jpg
the second one 19x19x19 but the checkered pattern dissapears: <a href="http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/19x19x19.jpg" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/19x19x19.jpg ).

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

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank"> http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers





--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Update: Point number limit in vtkColorTransferFunction?

Juan José Aja Fernández
Again, sorry for the double posting:

Hi, Randall:

Curiously I'm using VTK5.0 compiled from source but the problem persists, any ideas?

Thanks,

Juan.

On 2/10/06, Randall Hand <[hidden email]> wrote:
I ran into a similar goof a while back, reported here : <a href="http://www.vtk.org/Bug/bug.php?op=show&amp;bugid=2546&amp;pos=3" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Bug/bug.php?op=show&bugid=2546&pos=3

That's since been fixed in VTK5.0. What version are you using?

On 2/10/06, Juan José Aja Fernández <[hidden email]> wrote:
Sorry for the double post, apparently the vtkusers mailing system only admits text only messages.

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())->SetScala
rs(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 in the previous mail., the first one dimensions are: 5x5x5 and it looks good <a href="http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/5x5x5.jpg" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/5x5x5.jpg
the second one 19x19x19 but the checkered pattern dissapears: <a href="http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/19x19x19.jpg" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/attachments/20060210/d991c333/19x19x19.jpg ).

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

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers





--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: <a href="http://www.yeraze.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.yeraze.com


_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers