<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>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 <span style="font-weight: bold;">vtkSurfaceReconstructionFilter</span> 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 <span style="font-weight: bold;">SetExecuteMethod</span> belonging to the class <span style="font-weight: bold;">vtkProgrammableSource</span>. It appears as follows:<br><br>&nbsp;&nbsp;&nbsp; error C2660: "vtkProgrammableSource::SetExecuteMethod": 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 <span
 style="font-weight: bold;">readPoints</span> used in the first lines of the main.<br><br><br>&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">&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</span><br><br>#include "vtkSurfaceReconstructionFilter.h"<br>#include "vtkProgrammableSource.h"<br>#include "vtkContourFilter.h"<br>#include "vtkReverseSense.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkProperty.h"<br>#include "vtkCamera.h"<br>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "readPoints.h"<br><br>int main()<br>{<br><br>&nbsp;&nbsp;&nbsp; // Read some points. Use a programmable filter to read them.<br>&nbsp;&nbsp;&nbsp; vtkProgrammableSource* pointSource =
 vtkProgrammableSource::New();<br><br>&nbsp;&nbsp;&nbsp; readPoints(); <br><br>&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">pointSource-&gt;SetExecuteMethod(readPoints());</span>&nbsp;&nbsp;&nbsp; // ERROR !!<br><br><br>&nbsp;&nbsp;&nbsp; // Construct the surface and create isosurface.<br>&nbsp;&nbsp;&nbsp; vtkSurfaceReconstructionFilter* surf = vtkSurfaceReconstructionFilter::New();<br>&nbsp;&nbsp;&nbsp; surf-&gt;SetInputConnection(pointSource-&gt;GetOutputPort());<br><br>&nbsp;&nbsp;&nbsp; vtkContourFilter* cf = vtkContourFilter::New();<br>&nbsp;&nbsp;&nbsp; cf-&gt;SetInputConnection(surf-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; cf-&gt;SetValue(0, 0.0);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; // Sometimes the contouring algorithm can create a volume whose gradient<br>&nbsp;&nbsp;&nbsp; // vector and ordering of polygon (using the right hand rule) are<br>&nbsp;&nbsp;&nbsp; // inconsistent. vtkReverseSense cures this
 problem.<br>&nbsp;&nbsp;&nbsp; vtkReverseSense* reverse = vtkReverseSense::New();<br>&nbsp;&nbsp;&nbsp; reverse-&gt;SetInputConnection(cf-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; reverse-&gt;ReverseCellsOn();<br>&nbsp;&nbsp;&nbsp; reverse-&gt;ReverseNormalsOn();<br><br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper* map = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; map-&gt;SetInputConnection(reverse-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; map-&gt;ScalarVisibilityOff();<br><br>&nbsp;&nbsp;&nbsp; vtkActor* surfaceActor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; surfaceActor-&gt;SetMapper(map);<br>&nbsp;&nbsp;&nbsp; surfaceActor-&gt;GetProperty()-&gt;SetDiffuseColor(1.0000, 0.3882, 0.2784);<br>&nbsp;&nbsp;&nbsp; surfaceActor-&gt;GetProperty()-&gt;SetSpecularColor(1, 1, 1);<br>&nbsp;&nbsp;&nbsp; surfaceActor-&gt;GetProperty()-&gt;SetSpecular(.4);<br>&nbsp;&nbsp;&nbsp; surfaceActor-&gt;GetProperty()-&gt;SetSpecularPower(50);<br><br>&nbsp;&nbsp;&nbsp; //
 Create the RenderWindow, Renderer and both Actors<br>&nbsp;&nbsp;&nbsp; vtkRenderer* ren = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow* renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(ren);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);<br><br>&nbsp;&nbsp;&nbsp; // Add the actors to the renderer, set the background and size<br>&nbsp;&nbsp;&nbsp; ren-&gt;AddActor(surfaceActor);<br>&nbsp;&nbsp;&nbsp; ren-&gt;SetBackground(1, 1, 1);<br>&nbsp;&nbsp;&nbsp; renWin-&gt;SetSize(400, 400);<br>&nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;SetFocalPoint(0, 0, 0);<br>&nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;SetPosition(1, 0, 0);<br>&nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;SetViewUp(0, 0, 1);<br>&nbsp;&nbsp;&nbsp; ren-&gt;ResetCamera();<br>&nbsp;&nbsp;&nbsp;
 ren-&gt;GetActiveCamera()-&gt;Azimuth(20);<br>&nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;Elevation(30);<br>&nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;Dolly(1.2);<br>&nbsp;&nbsp;&nbsp; ren-&gt;ResetCameraClippingRange();<br><br>&nbsp;&nbsp;&nbsp; iren-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;Render();<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start();<br><br>&nbsp;&nbsp;&nbsp; return 0;<br><br>}<br><br><br>&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">&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</span><br><br>#include "vtkProgrammableSource.h"<br>#include "vtkReverseSense.h"<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; vtkProgrammableSource* pointSource = vtkProgrammableSource::New();<br>&nbsp;&nbsp;&nbsp; vtkPolyData* output = vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp; output = pointSource-&gt;GetPolyDataOutput();<br>&nbsp;&nbsp;&nbsp; vtkPoints* points = vtkPoints::New();<br>&nbsp;&nbsp;&nbsp; output-&gt;SetPoints(points);<br><br>// -1- Apertura file in lettura<br>&nbsp;&nbsp;&nbsp; ifstream fileStream("file_three-dimensional unorganized points.txt");<br><br>&nbsp;&nbsp;&nbsp; // -2- Controllo sulla correttezza dell'apertura del file<br>&nbsp;&nbsp;&nbsp; if( !fileStream )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cout &lt;&lt; "Impossibile aprire il file " &lt;&lt;
 endl;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 1;<br>&nbsp;&nbsp;&nbsp; }<br><br>// -3- Recupero linea per linea e assegnamento valori <br>&nbsp;&nbsp;&nbsp; string line;<br>&nbsp;&nbsp;&nbsp; vector&lt;string&gt; data;<br>&nbsp;&nbsp;&nbsp; float x, y, z; //Punti da inserire&nbsp; <br>&nbsp;&nbsp;&nbsp; while(getline(fileStream, line)) //Prende una nuova linea<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(!line.empty()) // se la linea non è vuota<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; data=split(line, ' '); //il carattere di separazione&nbsp; lo spazio<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&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; x=(float)atof(data[0].c_str());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 y=(float)atof(data[1].c_str());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; z=(float)atof(data[2].c_str());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;InsertNextPoint(x, y, z);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ////points.InsertNextPoint(x, y, z) // in Python<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&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; std::stringstream ss(s);<br>&nbsp;&nbsp;&nbsp; std::string item;<br>&nbsp;&nbsp;&nbsp; while(std::getline(ss, item, delim)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elems.push_back(item);<br>&nbsp;&nbsp;&nbsp; }<br>&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; std::vector&lt;std::string&gt;
 elems;<br>&nbsp;&nbsp;&nbsp; return split(s, delim, elems);<br>}<br><br><br><br></div></div><br>



      </body></html>