<HTML>
<HEAD>
<TITLE>Re: [vtkusers] Surfaces from unorganized point - vtkSurfaceReconstructionFilter</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I think the signature of your function should be defined as follows:<BR>
<BR>
</SPAN></FONT><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'><B>void </B>readPoints(<B>void*</B>)<BR>
{<BR>
...<BR>
}<BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
I haven&#8217;t tried it but from looking at the docs I think the callback function should return void and takes a void pointer as an argument.<BR>
<BR>
Gerrick<BR>
On 6/22/09 7:56 AM, &quot;Michele Natrella&quot; &lt;<a href="michele.cetma@yahoo.it">michele.cetma@yahoo.it</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'>Hi,<BR>
I am trying to represent a surface as a three-dimensional unorganized points. These pointsets come from a scan. To do this I am using <B>vtkSurfaceReconstructionFilter</B> which is a class specifically designed for this purpose. However there is an error that is driving me mad, it is caused by the method <B>SetExecuteMethod</B> belonging to the class <B>vtkProgrammableSource</B>. It appears as follows:<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;error C2660: &quot;vtkProgrammableSource::SetExecuteMethod&quot;: function does not take 1 parameters<BR>
<BR>
As following the code I wrote. I've put in bold the line which the error refers to, besides at the end of the message I reported the definition of the function <B>readPoints</B> used in the first lines of the main.<BR>
<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MAIN<BR>
</B><BR>
#include &quot;vtkSurfaceReconstructionFilter.h&quot;<BR>
#include &quot;vtkProgrammableSource.h&quot;<BR>
#include &quot;vtkContourFilter.h&quot;<BR>
#include &quot;vtkReverseSense.h&quot;<BR>
#include &quot;vtkPolyDataMapper.h&quot;<BR>
#include &quot;vtkProperty.h&quot;<BR>
#include &quot;vtkCamera.h&quot;<BR>
#include &quot;vtkRenderer.h&quot;<BR>
#include &quot;vtkRenderWindow.h&quot;<BR>
#include &quot;vtkRenderWindowInteractor.h&quot;<BR>
#include &quot;readPoints.h&quot;<BR>
<BR>
int main()<BR>
{<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Read some points. Use a programmable filter to read them.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkProgrammableSource* pointSource = vtkProgrammableSource::New();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;readPoints(); <BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B>pointSource-&gt;SetExecuteMethod(readPoints());</B> &nbsp;&nbsp;&nbsp;// ERROR !!<BR>
<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Construct the surface and create isosurface.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkSurfaceReconstructionFilter* surf = vtkSurfaceReconstructionFilter::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surf-&gt;SetInputConnection(pointSource-&gt;GetOutputPort());<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkContourFilter* cf = vtkContourFilter::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;cf-&gt;SetInputConnection(surf-&gt;GetOutputPort());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;cf-&gt;SetValue(0, 0.0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Sometimes the contouring algorithm can create a volume whose gradient<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// vector and ordering of polygon (using the right hand rule) are<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// inconsistent. vtkReverseSense cures this problem.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkReverseSense* reverse = vtkReverseSense::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;reverse-&gt;SetInputConnection(cf-&gt;GetOutputPort());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;reverse-&gt;ReverseCellsOn();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;reverse-&gt;ReverseNormalsOn();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkPolyDataMapper* map = vtkPolyDataMapper::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;map-&gt;SetInputConnection(reverse-&gt;GetOutputPort());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;map-&gt;ScalarVisibilityOff();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkActor* surfaceActor = vtkActor::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surfaceActor-&gt;SetMapper(map);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surfaceActor-&gt;GetProperty()-&gt;SetDiffuseColor(1.0000, 0.3882, 0.2784);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surfaceActor-&gt;GetProperty()-&gt;SetSpecularColor(1, 1, 1);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surfaceActor-&gt;GetProperty()-&gt;SetSpecular(.4);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;surfaceActor-&gt;GetProperty()-&gt;SetSpecularPower(50);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Create the RenderWindow, Renderer and both Actors<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderer* ren = vtkRenderer::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderWindow* renWin = vtkRenderWindow::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;renWin-&gt;AddRenderer(ren);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;iren-&gt;SetRenderWindow(renWin);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Add the actors to the renderer, set the background and size<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;AddActor(surfaceActor);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;SetBackground(1, 1, 1);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;renWin-&gt;SetSize(400, 400);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;SetFocalPoint(0, 0, 0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;SetPosition(1, 0, 0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;SetViewUp(0, 0, 1);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;ResetCamera();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;Azimuth(20);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;Elevation(30);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;GetActiveCamera()-&gt;Dolly(1.2);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ren-&gt;ResetCameraClippingRange();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;iren-&gt;Initialize();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;renWin-&gt;Render();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;iren-&gt;Start();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<BR>
<BR>
}<BR>
<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<B> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FUNCTION readPoints<BR>
</B><BR>
#include &quot;vtkProgrammableSource.h&quot;<BR>
#include &quot;vtkReverseSense.h&quot;<BR>
#include &lt;fstream&gt;<BR>
#include &lt;string&gt;<BR>
#include &lt;iostream&gt;<BR>
#include &lt;vector&gt;<BR>
#include &lt;sstream&gt;<BR>
#include &lt;cstdlib&gt;<BR>
<BR>
using namespace std;<BR>
<BR>
std::vector&lt;std::string&gt; &amp;split(const std::string &amp;s, char delim, std::vector&lt;std::string&gt; &amp;elems);<BR>
std::vector&lt;std::string&gt; split(const std::string &amp;s, char delim);<BR>
<BR>
int readPoints(void)<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkProgrammableSource* pointSource = vtkProgrammableSource::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkPolyData* output = vtkPolyData::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;output = pointSource-&gt;GetPolyDataOutput();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vtkPoints* points = vtkPoints::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;output-&gt;SetPoints(points);<BR>
<BR>
// -1- Apertura file in lettura<BR>
&nbsp;&nbsp;&nbsp;&nbsp;ifstream fileStream(&quot;file_three-dimensional unorganized points.txt&quot;);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// -2- Controllo sulla correttezza dell'apertura del file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if( !fileStream )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; &quot;Impossibile aprire il file &quot; &lt;&lt; endl;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 1;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
// -3- Recupero linea per linea e assegnamento valori <BR>
&nbsp;&nbsp;&nbsp;&nbsp;string line;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vector&lt;string&gt; data;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;float x, y, z; //Punti da inserire &nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;while(getline(fileStream, line)) //Prende una nuova linea<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!line.empty()) // se la linea non &egrave; vuota<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data=split(line, ' '); //il carattere di separazione &nbsp;lo spazio<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Conversione da std::string a float (se si vuole convertire in double sostituire atof con atod)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x=(float)atof(data[0].c_str());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y=(float)atof(data[1].c_str());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z=(float)atof(data[2].c_str());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points-&gt;InsertNextPoint(x, y, z);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;////points.InsertNextPoint(x, y, z) // in Python<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
return 0;<BR>
}<BR>
<BR>
std::vector&lt;std::string&gt; &amp;split(const std::string &amp;s, char delim, std::vector&lt;std::string&gt; &amp;elems) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;std::stringstream ss(s);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;std::string item;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;while(std::getline(ss, item, delim)) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elems.push_back(item);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return elems;<BR>
}<BR>
<BR>
std::vector&lt;std::string&gt; split(const std::string &amp;s, char delim) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;std::vector&lt;std::string&gt; elems;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return split(s, delim, elems);<BR>
}<BR>
<BR>
<BR>
<BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
&nbsp;<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_______________________________________________<BR>
Powered by www.kitware.com<BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>