Create "cuberille" kind of vtkPolyData from vtkImageData

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

Create "cuberille" kind of vtkPolyData from vtkImageData

joopeter
I am wondering what is the most straightforward way to create that kind of mesh in VTK.

You can check what is it here: http://www2.imm.dtu.dk/~janba/gallery/polygonization.html
cuberille

Obviously internal faces need to be avoided in the final mesh, that's why vtkImageDataGeometryFilter is not OK I guess.

I think the most complex part of this to correctly set up the mesh topology (which vertexes are connected to which other)  and to correctly set up cell ordering.

I understand that the final mesh is aliased compared to what Marching Cubes produces but for me this 'cuberille' behaviour is a must for my project.

Any opinion and pseudocode are welcome!
Reply | Threaded
Open this post in threaded view
|

Re: Create "cuberille" kind of vtkPolyData from vtkImageData

David Gobbi
On Sun, Feb 3, 2013 at 1:02 PM, joopeter <[hidden email]> wrote:

> I am wondering what is the most straightforward way to create that kind of
> mesh in VTK.
>
> You can check what is it here:
> http://www2.imm.dtu.dk/~janba/gallery/polygonization.html
> <http://vtk.1045678.n5.nabble.com/file/n5718248/cuberille-candypig.png>
>
> Obviously internal faces need to be avoided in the final mesh, that's why
> vtkImageDataGeometryFilter is not OK I guess.
>
> I think the most complex part of this to *correctly set up the mesh
> topology* (which vertexes are connected to which other)  and to *correctly
> set up cell ordering*.
>
> I understand that the final mesh is aliased compared to what Marching Cubes
> produces but for me this 'cuberille' behaviour is a must for my project.
>
> Any opinion and pseudocode are welcome!

This might be possible as a two-stage process:

1) Use vtkThreshold to create a 3D mesh that only contains voxels
above threshold.

2) Use vtkGeometryFilter to get all the polygons that make up the
surface of the mesh.

 - David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK 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: Create "cuberille" kind of vtkPolyData from vtkImageData

David Gobbi
On Sun, Feb 3, 2013 at 1:18 PM, David Gobbi <[hidden email]> wrote:

> On Sun, Feb 3, 2013 at 1:02 PM, joopeter <[hidden email]> wrote:
>> I am wondering what is the most straightforward way to create that kind of
>> mesh in VTK.
>>
>> You can check what is it here:
>> http://www2.imm.dtu.dk/~janba/gallery/polygonization.html
>> <http://vtk.1045678.n5.nabble.com/file/n5718248/cuberille-candypig.png>
>>
>> Obviously internal faces need to be avoided in the final mesh, that's why
>> vtkImageDataGeometryFilter is not OK I guess.
>>
>> I think the most complex part of this to *correctly set up the mesh
>> topology* (which vertexes are connected to which other)  and to *correctly
>> set up cell ordering*.
>>
>> I understand that the final mesh is aliased compared to what Marching Cubes
>> produces but for me this 'cuberille' behaviour is a must for my project.
>>
>> Any opinion and pseudocode are welcome!
>
> This might be possible as a two-stage process:
>
> 1) Use vtkThreshold to create a 3D mesh that only contains voxels
> above threshold.
>
> 2) Use vtkGeometryFilter to get all the polygons that make up the
> surface of the mesh.

Actually, since you've already used vtkImageDataGeometry filter, do this:

1) vtkImageDataGeometryFilter (extract the voxels)
2) vtkGeometryFilter (extract the external faces)

 - David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK 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: Create "cuberille" kind of vtkPolyData from vtkImageData

Bill Lorensen
In reply to this post by joopeter
Check out this wiki example:
http://itk.org/Wiki/VTK/Examples/Cxx/Medical/GenerateCubesFromLabels

I believe it does exactly what you want.

Bill

On Sun, Feb 3, 2013 at 3:02 PM, joopeter <[hidden email]> wrote:

> I am wondering what is the most straightforward way to create that kind of
> mesh in VTK.
>
> You can check what is it here:
> http://www2.imm.dtu.dk/~janba/gallery/polygonization.html
> <http://vtk.1045678.n5.nabble.com/file/n5718248/cuberille-candypig.png>
>
> Obviously internal faces need to be avoided in the final mesh, that's why
> vtkImageDataGeometryFilter is not OK I guess.
>
> I think the most complex part of this to *correctly set up the mesh
> topology* (which vertexes are connected to which other)  and to *correctly
> set up cell ordering*.
>
> I understand that the final mesh is aliased compared to what Marching Cubes
> produces but for me this 'cuberille' behaviour is a must for my project.
>
> Any opinion and pseudocode are welcome!
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Create-cuberille-kind-of-vtkPolyData-from-vtkImageData-tp5718248.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK 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: Create "cuberille" kind of vtkPolyData from vtkImageData

joopeter
Thanks Bill, thanks David I'll take a look on these.

One note though: if an intermediate step creates internal faces too then the algorithm create O(N^3) unwanted intermediate faces while at the end the remainings are O(N^2).
(ie: volume of a cube is X*X*X while surface area is 6*X*X).

For large data set it is not acceptable.
Reply | Threaded
Open this post in threaded view
|

Re: Create "cuberille" kind of vtkPolyData from vtkImageData

Bill Lorensen
I suggest trying the example. If it turns out to be slow, then we can
address that issue.


On Sun, Feb 3, 2013 at 3:46 PM, joopeter <[hidden email]> wrote:

> Thanks Bill, thanks David I'll take a look on these.
>
> One note though: if an intermediate step creates internal faces too then the
> algorithm create O(N^3) unwanted intermediate faces while at the end the
> remainings are O(N^2).
> (ie: volume of a cube is X*X*X while surface area is 6*X*X).
>
> For large data set it is not acceptable.
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Create-cuberille-kind-of-vtkPolyData-from-vtkImageData-tp5718248p5718252.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK 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: Create "cuberille" kind of vtkPolyData from vtkImageData

joopeter
Bill, the example does exactly what I need, thank you again.

Also I debugged the code behind vtkGeometryFilter and I now how it works. (line 790, case VTK_VOXEL)

Also i tried the example to load 512^3 ushort volume and it consumed too much memory (~900mb) and it crashed telling that further memory allocation is not possible.

A sphere at resolution of 512^3 needs around 6*512*512=1.572.864 quadrilateral so I think better algorithms exists out there.

Bill, do you think that this can be done in VTK without writing a new filter for it?

If so I have to write my own VTK filter based on the aboves and these:
http://www.volumesoffun.com/polyvox/documentation/0.2.1/api/class_poly_vox_1_1_cubic_surface_extractor.html
http://www.insight-journal.org/browse/publication/740




Reply | Threaded
Open this post in threaded view
|

Re: Create "cuberille" kind of vtkPolyData from vtkImageData

Bill Lorensen
Why not use the polyvox code? If you need to connect it to vtk, you
could write a filter to go from their format to vtk.

On Mon, Feb 4, 2013 at 7:55 AM, joopeter <[hidden email]> wrote:

> Bill, the example does exactly what I need, thank you again.
>
> Also I debugged the code behind vtkGeometryFilter and I now how it works.
> (line 790, case VTK_VOXEL)
>
> Also i tried the example to load 512^3 ushort volume and it consumed too
> much memory (~900mb) and it crashed telling that further memory allocation
> is not possible.
>
> A sphere at resolution of 512^3 needs around 6*512*512=1.572.864
> quadrilateral so I think better algorithms exists out there.
>
> Bill, do you think that this can be done in VTK without writing a new filter
> for it?
>
> If so I have to write my own VTK filter based on the aboves and these:
> http://www.volumesoffun.com/polyvox/documentation/0.2.1/api/class_poly_vox_1_1_cubic_surface_extractor.html
> http://www.insight-journal.org/browse/publication/740
>
>
>
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Create-cuberille-kind-of-vtkPolyData-from-vtkImageData-tp5718248p5718261.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers