I am researching an efficient 3D visualization system.  VTK is the first one I picked up.  It is really a pleasure to read the documentation and example.  It is also straightforward to write a quick benchmark example thanks to its Python binding. <br>
<br>However, I quickly encountered an obvious bug in VTK.  In order to get around,  I then find  VTK intolerably inefficient...  All seem to be due to serious design and implementation faults.  Well, I am just a beginner who just picked up VTK which has been there for more than a decade.  It seems I am the obviously stupid one to laugh at, but really?  Anyway, I would like to challenge the experienced VTK users and developers in the mailing list: <br>
<br>       Is VTK really so inefficient for such a simple task? If so, why would anyone like to spend time on it?  <br><br>Here is my story.  I read in a structured grid which has about 500k cells.  VTK renders it quite fast and everything looks so well.  Well done!<br>
<br>Then, my nightmare begins.  I need to delete a set of cells which have zero values in the scalars.  The VTK manual explicitly states that the BlankCell / BlankPoint does exactly that for structured grid.  However, this is an unbelievable bug in VTK!  BlankCell/BlankPoint does not at all.  If you google &quot;VTK blankpoint&quot;, you may find many posts that reported this did not work from as early as 2004.  A quite good description is here: <a href="http://vtk.1045678.n5.nabble.com/Blanking-a-point-in-a-vtkStructuredGrid-td5474001.html">http://vtk.1045678.n5.nabble.com/Blanking-a-point-in-a-vtkStructuredGrid-td5474001.html</a><br>
<br>I got some kind help from a developer and was hinted to use vtkThreshold to hide those cells that I don&#39;t want.  This really sounds like a plausible solution, but it turned out to destroy my last faith in VTK. I used the vtkThreshold and it worked.  However, the new problem is that now the rendering becomes very very slow!  It takes about 5 seconds to update when I rotate it. That is not acceptable at all.  The problem is that when vtkThreshold is applied, the output of the filter becomes unstructured grid.  It seems VTK is not so competent in visualizing the unstructured grid,  and everything is slowed down badly.  Again, it is sad to see other people reported this issue long time ago (<a href="http://vtk.1045678.n5.nabble.com/Efficient-thresholding-td1240897.html#a1240898">http://vtk.1045678.n5.nabble.com/Efficient-thresholding-td1240897.html#a1240898</a>) -- without any reply, again. <br>
<br>I feel it is incredible that VTK is so incompetent in doing such a simple task.   Actually I would feel sorry for the experienced users and developers if that is really the case.  Ok, please give me a lesson if you think I am wrong.  Although the code is in Python,  I don&#39;t think a C++ implementation could speed things up much. <br>
<br>Here is the part I did the visualization.  (self.grid is just an ordinary vtkStructuredGrid with a scalar array set up.)  <br><br>        geometry = vtk.vtkGeometryFilter()<br><br>        # key part:  if to_cut_cells is true,  it is terribly slow because of the thresholding, otherwise very fast <br>
        if to_cut_cells :<br>            active = vtk.vtkThreshold()<br>            active.SetInput(self.grid)<br>            active.ThresholdByUpper(0.1)<br>            active.SetInputArrayToProcess(0, 0, 0, vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS, vtk.vtkDataSetAttributes.SCALARS)<br>
            active.Update()            <br>            geometry.SetInputConnection(active.GetOutputPort())<br>       else:                    <br>            geometry.SetInput(self.grid)        <br>        <br>        mapper = vtk.vtkPolyDataMapper()<br>
        mapper.SetInputConnection(geometry.GetOutputPort())<br>        lut = vtk.vtkLookupTable()<br>        lut.SetHueRange(0,  0.667)        <br>        mapper.SetLookupTable(lut)<br>        mapper.SetScalarModeToUseCellData()<br>
        mapper.SetScalarRange(self.grid.GetScalarRange())<br>        <br>        actor = vtk.vtkActor()<br>        actor.SetMapper(mapper)<br>        actor.SetScale(1,  1,  10)   <br><br>        ....<br><br><br>