<div><div dir="auto">Hi,</div></div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, 26 Sep 2018 at 20.16, Ruben Di Battista <<a href="mailto:rubendibattista@gmail.com">rubendibattista@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I would probably guess that's not your laptop <i>per se</i>, but probably how you compiled/installed VTK on it. You could try to use, for example, a Virtual Machine to check that...<br><br>Are you using Conda?</div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr"></div></div></blockquote><div dir="auto"><br></div><div dir="auto">No, as I wrote in a previous message, I used Christophe Gohlke’s precompiled Python wheel for Windows. Since they are for Python 2.7 64 bit, there is no underlying reason for them not to work, unless VTK is incompatible with my graphics card for some reason. </div><div dir="auto"><br></div><div dir="auto">Even then, though, I don’t think VTK should bomb out the interpreter. Some sort of exception raised is surely far more preferable to a hard crash, no?</div><div dir="auto"><br></div><div dir="auto">Andrea.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div dir="ltr">On Wed, Sep 26, 2018 at 6:25 PM Andrea Gavana <<a href="mailto:andrea.gavana@gmail.com" target="_blank">andrea.gavana@gmail.com</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Hi Andras,</div></div><div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, 26 Sep 2018 at 19.00, Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_7370175850526299207m_3214017633723629240m_5515558100195883864WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Your script works well in Paraview’s embedded Python interpreter, too.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">It seems that something is wrong in your Python/VTK environment. To confirm, you can check if other
<a href="https://lorensen.github.io/VTKExamples/site/" target="_blank">VTK Python examples</a> crash, too.</span></p></div></div></blockquote><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">It appears that the issue is due to my laptop Intel’s integrated graphics card (!). I have tried on another, more serious machine with a NVidia graphics card and the script works flawlessly...</div><div dir="auto"><br></div><div dir="auto">I understand that my laptop may not be super duper (it’s fairly new though) in terms of GPU processing but I was not trying to visualize millions of polyhedrons, just 6 polygons... I wonder why VTK bombs out like that...</div><div dir="auto"><br></div><div dir="auto">Thank you again for investigating and for your suggestions.</div><div dir="auto"><br></div><div dir="auto">Andrea.</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_7370175850526299207m_3214017633723629240m_5515558100195883864WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Andras<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Andrea Gavana <<a href="mailto:andrea.gavana@gmail.com" target="_blank">andrea.gavana@gmail.com</a>>
<br>
<b>Sent:</b> Wednesday, September 26, 2018 11:53 AM<br>
<b>To:</b> Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>><br>
<b>Cc:</b> <a href="mailto:vtkusers@public.kitware.com" target="_blank">vtkusers@public.kitware.com</a><br>
<b>Subject:</b> Re: [vtkusers] Simple 2D unstructured grid<u></u><u></u></span></p></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_7370175850526299207m_3214017633723629240m_5515558100195883864WordSection1">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Andras,<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, 26 Sep 2018 at 17:37, Andras Lasso <<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Works well for me in 3D Slicer’s embedded Python 2.7 64 bit, both with latest VTK master and VTK 7.1.0.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you for trying it out. I have upgraded VTK to 7.1.1 from Gohlke's site but the program still crashes Python hard. Does anyone know what might be going on?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Andrea.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Andras</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> vtkusers <<a href="mailto:vtkusers-bounces@public.kitware.com" target="_blank">vtkusers-bounces@public.kitware.com</a>>
<b>On Behalf Of </b>Andrea Gavana<br>
<b>Sent:</b> Wednesday, September 26, 2018 10:23 AM<br>
<b>To:</b> <a href="mailto:vtkusers@public.kitware.com" target="_blank">vtkusers@public.kitware.com</a><br>
<b>Subject:</b> [vtkusers] Simple 2D unstructured grid</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hello list,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> I m trying to create a very, very simple 2D unstructured grid but every time I run my script - no matter what modifications I do - Python crashes hard with a Windows message
"Python has stopped working...".<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">A simplified version of my grid is in the picture below (done in Excel, sorry...):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><img border="0" width="481" height="289" style="width:5.0104in;height:3.0104in" id="m_7370175850526299207m_3214017633723629240m_5515558100195883864m_-4479680425648124611_x005f_x0000_i1025" alt="image.png"><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I attach a copy of my script below. Could anyone offer some suggestions on what I am doing wrong? I am using VTK 7.1.0 on Windows 7 64 bit, Python 2.7 64 bit - VTK comes from Christophe
Gohlke very useful Python binary wheels.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you in advance for your help.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Andrea.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># -- BEGIN CODE -- #<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">import numpy<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">import vtk<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">import vtk.util.numpy_support as numpy_support<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># X, Y coordinates of a simple grid - Z is zero<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">X = [600.4957421, 600.5, 600.5, 600.4957421, 600.4913048, 600.5,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 600.5, 600.4957421, 600.4913048, 600.4868674, 600.5, 600.5,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 600.4913048, 600.4868674, 600.4824301, 600.5, 600.5, 600.4868674,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 600.4824301, 600.4779928, 600.5, 600.5, 600.4824301, 600.4779928,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 600.4735554, 600.5, 600.5, 600.4779928, 600.4735554]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Y = [2940.5, 2940.5, 2940.404044, 2940.5, 2940.6, 2940.6, 2940.5,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 2940.5, 2940.6, 2940.7, 2940.7, 2940.6, 2940.6, 2940.7, 2940.8,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 2940.8, 2940.7, 2940.7, 2940.8, 2940.9, 2940.9, 2940.8, 2940.8,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 2940.9, 2941, 2941, 2940.9, 2940.9, 2941]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># First face is triangular, everything else is a 4-sided polygon<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">IDS = [range(4)]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">IDS += numpy.split(numpy.arange(4, len(X)), 5)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">npoints = len(X)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">matrix = numpy.zeros((npoints, 3), numpy.float32)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">matrix[:, 0] = X<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">matrix[:, 1] = Y<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Create the grid points<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">vtk_pts = vtk.vtkPoints()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">vtk_pts.SetData(numpy_support.numpy_to_vtk(matrix, deep=1))<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Create the unstructured grid<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grid = vtk.vtkUnstructuredGrid()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grid.SetPoints(vtk_pts)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Allocate space for the cells in the grid<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">nc = len(IDS)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">grid.Allocate(nc)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Loop through all cells<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">for i in xrange(nc):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> cell_ids = IDS[i]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> ncoords = len(cell_ids)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> grid.InsertNextCell(vtk.VTK_POLYGON, ncoords, cell_ids)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">print grid.GetNumberOfCells(), nc<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mapper = vtk.vtkDataSetMapper()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mapper.SetInputData(grid)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">actor = vtk.vtkActor()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">actor.SetMapper(mapper)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ren = vtk.vtkRenderer()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">renWin = vtk.vtkRenderWindow()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">renWin.AddRenderer(ren)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">iren = vtk.vtkRenderWindowInteractor()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">iren.SetRenderWindow(renWin)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Add the actors to the renderer, set the background and size<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ren.AddActor(actor)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ren.SetBackground(0, 0, 0)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># This allows the interactor to initalize itself. It has to be<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># called before an event loop.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">iren.Initialize()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ren.ResetCamera()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">renWin.Render()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"># Start the event loop.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">iren.Start()<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_7370175850526299207gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font face="monospace, monospace"> _ </font></div><div><font face="monospace, monospace">-. .´ |∞∞∞∞</font></div><div><font face="monospace, monospace"> ', ; |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace"> ˜˜ |∞∞∞∞∞∞∞∞∞ RdB </font></div><div><font face="monospace, monospace"> ,., |∞∞∞∞∞∞</font></div><div><font face="monospace, monospace"> .' '. |∞∞∞∞</font></div><div><font face="monospace, monospace">-' `'</font></div><div><font face="monospace, monospace"><a href="http://rdb.is" target="_blank">https://rdb.is</a></font></div><div><br></div></div></div></div></div>
</blockquote></div></div>