[vtkusers] marching cubes: scalar values equal to isovalue

Bill Lorensen bill.lorensen at gmail.com
Wed Mar 2 10:13:28 EST 2011


You should set the iso value to be between 0 and 1, not at 0 or 1.


On Wed, Mar 2, 2011 at 7:51 AM, Eduardo Suarez-Santana
<esuarez at itccanarias.org> wrote:
> El 01/03/11 17:33, Bill Lorensen escribió:
>> Edges are generated on cell faces, triangles are not generated on cell
>> faces. So, you will have shared edges, but never shared faces.
>
> You are right. What I meant was that there were two triangles in the
> same position.
>
> This is a small python script where, as far as I understand, generates
> two triangles in the same position, coincident with the shared face.
> These are the triangles which enclose no volume, and I'd like to remove.
>
> ---- BEGIN HERE ----
> #!/usr/bin/python
>
> import vtk
>
> # three 'ones' in their common face
> st = vtk.vtkStructuredPoints()
> st.SetDimensions(2,3,2)
> st.AllocateScalars()
> sc = (st.GetPointData()).GetScalars()
> sc.SetValue(  0, 0.0 )
> sc.SetValue(  1, 0.0 )
> sc.SetValue(  2, 1.0 )
> sc.SetValue(  3, 1.0 )
> sc.SetValue(  4, 0.0 )
> sc.SetValue(  5, 0.0 )
> sc.SetValue(  6, 0.0 )
> sc.SetValue(  7, 0.0 )
> sc.SetValue(  8, 0.0 )
> sc.SetValue(  9, 1.0 )
> sc.SetValue( 10, 0.0 )
> sc.SetValue( 11, 0.0 )
>
> mc = vtk.vtkMarchingCubes()
> mc.SetNumberOfContours(1)
> mc.SetValue( 0, 1.0 )
> mc.SetInput(st)
> mc.Update()
>
> pd = mc.GetOutput()
> print "Number of Cells: %d\n" % pd.GetNumberOfCells() # return 2L
> print pd.GetCell(0) # return a triangle, coincident with the face
> print pd.GetCell(1) # return another triangle, in the same position
> ---- END HERE ----
>
>



More information about the vtkusers mailing list