<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Karthik,</DIV>
<DIV>&nbsp;</DIV>
<DIV>It is working now. I had to create vtkPolydata structure per contour and <FONT size=2></DIV>
<DIV>vtkAppendPolyData to combine them.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best Wishes</DIV>
<DIV>Yogish</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT><BR><BR>--- On <B>Wed, 12/8/09, Yogish Mallya <I>&lt;mallyayogish@yahoo.co.in&gt;</I></B> wrote:<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Yogish Mallya &lt;mallyayogish@yahoo.co.in&gt;<BR>Subject: Re: [vtkusers] Surface from contours<BR>To: "Karthik Krishnan" &lt;karthik.krishnan@kitware.com&gt;<BR>Cc: vtkusers@vtk.org, "itk" &lt;insight-users@itk.org&gt;<BR>Date: Wednesday, 12 August, 2009, 11:33 AM<BR><BR>
<DIV id=yiv1669483714>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Thank you Karthik for the quick response.</FONT> 
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>I wrote following code to convert the contour points to surface. But the vtk ouput file is blank. i.e no vertices and cells. What might <SPAN>&nbsp;</SPAN>me the reason ?</FONT> 
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>&nbsp;</FONT> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">FILE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> *<SPAN style="COLOR: black">datei</SPAN> = <SPAN style="COLOR: black">fopen</SPAN>(<SPAN style="COLOR: maroon">"C:/inputpoints.txt"</SPAN>,<SPAN style="COLOR: maroon">"rt"</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">vtkPolyData</SPAN> *<SPAN style="COLOR: black">data</SPAN> = <SPAN style="COLOR: black">vtkPolyData</SPAN>::<SPAN style="COLOR: black">New</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">vtkPoints</SPAN> *<SPAN style="COLOR: black">points</SPAN> = <SPAN style="COLOR: black">vtkPoints</SPAN>::<SPAN style="COLOR: black">New</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">vtkCellArray</SPAN><SPAN>&nbsp; </SPAN>*<SPAN style="COLOR: black">Lines</SPAN> = <SPAN style="COLOR: black">vtkCellArray</SPAN> ::<SPAN style="COLOR: black">New</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> <SPAN style="COLOR: black">iCounter</SPAN> = 0;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">while</SPAN> (!<SPAN style="COLOR: black">feof</SPAN>(<SPAN style="COLOR: black">datei</SPAN>))</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">fprintf</SPAN>(<SPAN style="COLOR: black">stdout</SPAN>,<SPAN style="COLOR: maroon">"reading points: %i\r"</SPAN>, <SPAN style="COLOR: black">iCounter</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">float</SPAN> <SPAN style="COLOR: black">x</SPAN>, <SPAN style="COLOR: black">y</SPAN>, <SPAN style="COLOR: black">z</SPAN>;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">fscanf</SPAN>(<SPAN style="COLOR: black">datei</SPAN>,<SPAN style="COLOR: maroon">"%f %f %f\n"</SPAN>, &amp;<SPAN style="COLOR: black">x</SPAN>, &amp;<SPAN style="COLOR: black">y</SPAN>, &amp;<SPAN style="COLOR: black">z</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">points</SPAN>-&gt;<SPAN style="COLOR: black">InsertPoint</SPAN>(<SPAN style="COLOR: black">iCounter</SPAN>++, <SPAN style="COLOR: black">x</SPAN>, <SPAN style="COLOR: black">y</SPAN>, <SPAN style="COLOR: black">z</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">Lines</SPAN>-&gt;<SPAN style="COLOR: black">InsertCellPoint</SPAN>( <SPAN style="COLOR: black">iCounter</SPAN> );</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">data</SPAN>-&gt;<SPAN style="COLOR: black">SetPoints</SPAN>(<SPAN style="COLOR: black">points</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">data</SPAN>-&gt;<SPAN style="COLOR: black">SetLines</SPAN>(<SPAN style="COLOR: black">Lines</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">fclose</SPAN>(<SPAN style="COLOR: black">datei</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">fprintf</SPAN>(<SPAN style="COLOR: black">stdout</SPAN>,<SPAN style="COLOR: maroon">"\n\n"</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">vtkRuledSurfaceFilter</SPAN> *<SPAN style="COLOR: black">ruledSurfaceFilter</SPAN> = <SPAN style="COLOR: black">vtkRuledSurfaceFilter</SPAN>::<SPAN style="COLOR: black">New</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">ruledSurfaceFilter</SPAN>-&gt;<SPAN style="COLOR: black">SetInput</SPAN>(<SPAN style="COLOR: black">data</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">ruledSurfaceFilter</SPAN>-&gt;<SPAN style="COLOR: black">SetRuledModeToResample</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">ruledSurfaceFilter</SPAN>-&gt;<SPAN style="COLOR: black">CloseSurfaceOn</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">ruledSurfaceFilter</SPAN>-&gt;<SPAN style="COLOR: black">Update</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">vtkDataSetWriter</SPAN> *<SPAN style="COLOR: black">dsw</SPAN> = <SPAN style="COLOR: black">vtkDataSetWriter</SPAN>::<SPAN style="COLOR: black">New</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">dsw</SPAN>-&gt;<SPAN style="COLOR: black">SetInput</SPAN>((<SPAN style="COLOR: black">vtkPolyData</SPAN>*)<SPAN style="COLOR: black">ruledSurfaceFilter</SPAN>-&gt;<SPAN style="COLOR: black">GetOutput</SPAN>());<SPAN>&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">dsw</SPAN>-&gt;<SPAN style="COLOR: black">SetFileName</SPAN>(<SPAN style="COLOR: maroon">"c:/RuledSurface.vtk"</SPAN>);</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: black">dsw</SPAN>-&gt;<SPAN style="COLOR: black">Write</SPAN>();</SPAN> 
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3></FONT>&nbsp; 
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Rgds,</FONT> 
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Yogish</FONT><BR><BR>--- On <B>Wed, 12/8/09, Karthik Krishnan <I>&lt;karthik.krishnan@kitware.com&gt;</I></B> wrote:<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Karthik Krishnan &lt;karthik.krishnan@kitware.com&gt;<BR>Subject: Re: [vtkusers] Surface from contours<BR>To: "Yogish Mallya" &lt;mallyayogish@yahoo.co.in&gt;<BR>Cc: vtkusers@vtk.org, "itk" &lt;insight-users@itk.org&gt;<BR>Date: Wednesday, 12 August, 2009, 11:05 AM<BR><BR>
<DIV id=yiv2079170299>Graphics/Testing/Tcl/TestRuledSurface*.tcl<BR><BR>The difference from the tests is that you need to set "ClosedSurfaceOn()". <BR><BR>Also, if the number of points in each of the contours is different or not in correspondance, you'll want to resample the contours by setting "SetRuledModeToResample()".<BR><BR>And there are ways to do this without using vtkRuledSurfaceFilter as well... <BR><BR>You could rasterize the contours (vtkPolygon::PointInPolygon), treat the result as an image, run an AntiAlias filter (ITK) and then triangulate by generating an isosurface with marching cubes.<BR><BR><BR><BR><BR><BR>
<DIV class=gmail_quote>On Tue, Aug 11, 2009 at 10:05 PM, Yogish Mallya <SPAN dir=ltr>&lt;<A href="http://in.mc952.mail.yahoo.com/mc/compose?to=mallyayogish@yahoo.co.in" target=_blank rel=nofollow>mallyayogish@yahoo.co.in</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD style="FONT-FAMILY: inherit; font-stretch: inherit; font-size-adjust: inherit" vAlign=top><BR><BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<P style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Hi All,</FONT> 
<DIV></DIV>
<P style="MARGIN: 0in 0in 10pt"><FONT size=3><FONT face=Calibri>I have a text file containing a set of points representing three parallel contours in Z-direction (text file is attached in the mail). <SPAN>&nbsp;</SPAN>The point set in the file is ordered. <SPAN>&nbsp;</SPAN>I want to generate a triangular surface mesh from these contours. vtkRuledSurfaceFilter seems to be the correct solution. It would be great if somebody can share a c++ example or steps on how to use this filter ?&nbsp;<SPAN>&nbsp;</SPAN></FONT></FONT> 
<DIV></DIV>
<P style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Regards,</FONT> 
<DIV></DIV>
<P style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>Yogish</FONT></DIV></TD></TR></TBODY></TABLE></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE><BR>
<DIV class=hm><BR>
<HR SIZE=1>
Yahoo! recommends that you upgrade to the new and safer <A href="http://in.rd.yahoo.com/tagline_ie8_1/*http://downloads.yahoo.com/in/internetexplorer/" target=_blank rel=nofollow>Internet Explorer 8</A>.</DIV><BR>_______________________________________________<BR>Powered by <A href="http://www.kitware.com/" target=_blank rel=nofollow>www.kitware.com</A><BR><BR>Visit other Kitware open-source projects at <A href="http://www.kitware.com/opensource/opensource.html" target=_blank rel=nofollow>http://www.kitware.com/opensource/opensource.html</A><BR><BR>Please keep messages on-topic and check the VTK FAQ at: <A href="http://www.vtk.org/Wiki/VTK_FAQ" target=_blank rel=nofollow>http://www.vtk.org/Wiki/VTK_FAQ</A><BR><BR>Follow this link to subscribe/unsubscribe:<BR><A href="http://www.vtk.org/mailman/listinfo/vtkusers" target=_blank rel=nofollow>http://www.vtk.org/mailman/listinfo/vtkusers</A><BR><BR></BLOCKQUOTE><BR><BR clear=all><BR>-- <BR>Karthik
 Krishnan<BR>R&amp;D Engineer,<BR>Kitware Inc.<BR>Ph: 518 881 4919<BR>Fax: 518 371 4573<BR></DIV></DIV></BLOCKQUOTE><BR>
<HR SIZE=1>
Yahoo! recommends that you upgrade to the new and safer <A href="http://in.rd.yahoo.com/tagline_ie8_1/*http://downloads.yahoo.com/in/internetexplorer/" target=_blank rel=nofollow>Internet Explorer 8</A>.
<DIV></DIV>
<BLOCKQUOTE></BLOCKQUOTE></TR></TBODY></DIV></BLOCKQUOTE></td></tr></table><br>



      <!--3--><hr size=1></hr> Looking for local information? Find it on <a href="http://in.rd.yahoo.com/tagline_local_1/*http://in.local.yahoo.com/" target="_blank"> Yahoo! Local</a>