<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi there,<div class=""><br class=""></div><div class="">I am going to read a set of discrete 3D points (<font face="Courier New" class="">float</font> value, not <font face="Courier New" class="">int</font> value) and show both the points and the fitting surface via VTK’s implicit functions, say vtkImplicitVolume or vtkImplicitDataSet.</div><div class=""><br class=""></div><div class="">It works fine of the numpy arrary to vtkImageData conversion in the following code, but is out of my mind how to convert it to vtkDataSet, which is my requirement.</div><div class=""><br class=""></div><div class=""><font face="Courier New" class="">```Python</font></div><div class=""><div class=""><font face="Courier New" class="">    # Convert numpy array to VTK array (vtkFloatArray)</font></div></div><div class=""><font face="Courier New" class="">    vtk_data_array = numpy_support.numpy_to_vtk(</font></div><div class=""><div class=""><font face="Courier New" class="">        num_array=ndarray.transpose(2, 1, 0).ravel(),  # ndarray contains the fitting result from the points. It is a 3D array</font></div><div class=""><font face="Courier New" class="">        deep=True,</font></div><div class=""><font face="Courier New" class="">        array_type=vtk.VTK_FLOAT)</font></div><div class=""><font face="Courier New" class=""><br class=""></font></div><div class=""><font face="Courier New" class="">    # Convert the VTK array to vtkImageData</font></div><div class=""><font face="Courier New" class="">    img_vtk = vtk.vtkImageData()</font></div><div class=""><font face="Courier New" class="">    img_vtk.SetDimensions(ndarray.shape)</font></div><div class=""><font face="Courier New" class="">    img_vtk.SetSpacing(spacing[::-1])</font></div><div class=""><font face="Courier New" class="">    img_vtk.GetPointData().SetScalars(vtk_data_array)</font></div></div><div class=""><font face="Courier New" class=""><br class=""></font></div><div class=""><font face="Courier New" class="">    # …</font></div><div class=""><font face="Courier New" class=""><div class="">    implicit_volume = vtk.vtkImplicitVolume()  # I want a vtkImplicitDataSet, whose input is a vtkDataSet</div><div class="">    implicit_volume.SetVolume(img_vtk)</div></font></div><div class=""><font face="Courier New" class="">```</font></div><div class=""><br class=""></div><div class="">Because vtkImageData scales all points to positive integer values so that the rendering result mismatches the original points, I deem vtkDataSet or its subclass can do it. Anybody knows how to convert?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Quentan</div></body></html>