installing Mayavi with pip - no module named 'vtkOpenGLKitPython'
I am trying to install mayavi via pip on my ubuntu 16.04 via shell. I am using python 3.6 via anaconda and already installed vtk and all other requirements but i get the above error when i try pip3 install mayavi or pip2 install mayavi.
See also questions close to this topic
Any Sources to Download free 3d medical images with (.mhd) files?
I'm Working on a medical application depending on VTK (visualization toolkit library). This application reads the 3d image(.raw file) depending on its header file(.mhd file). (.mhd file) is very important because it has needed informations about (.raw file).
My problem is
I can not find sources that provide (3d images + header files). Please help me If you have any idea .
Close the gap between a mesh and a plane
I have converted an .obj mesh file to .stl. I also created a planar geometry as a holder for the mesh object then merge them. However, it contains a gap. Any suggestion how to close the gap vertically so that it becomes a solid object, I have already tried vtkFillHolesFilter and the manual way, but it won't fill the gap?
The code to create the planar:
implicitPolyDataDistance = vtk.vtkImplicitPolyDataDistance() implicitPolyDataDistance.SetInput(stl_poly_data) #create a grid xCoords = vtk.vtkFloatArray() for x, i in enumerate(np.linspace(xmin, xmax,50)): xCoords.InsertNextValue(i) yCoords = vtk.vtkFloatArray() for y, i in enumerate(np.linspace(ymin, ymax, 50)): yCoords.InsertNextValue(i) zCoords = vtk.vtkFloatArray() for z, i in enumerate(np.linspace(zmin, zmin + 1, 50)): zCoords.InsertNextValue(i) rgrid = vtk.vtkRectilinearGrid() rgrid.SetDimensions(x + 1, y + 1 , z + 1) rgrid.SetXCoordinates(xCoords) rgrid.SetYCoordinates(yCoords) rgrid.SetZCoordinates(zCoords) signedDistances = vtk.vtkFloatArray() signedDistances.SetNumberOfComponents(1) signedDistances.SetName("SignedDistances") # Evaluate the signed distance function at all of the grid points for pointId in range(rgrid.GetNumberOfPoints()): p = rgrid.GetPoint(pointId) signedDistance = implicitPolyDataDistance.EvaluateFunction(p) signedDistances.InsertNextValue(signedDistance) # add the SignedDistances to the grid rgrid.GetPointData().SetScalars(signedDistances) # geometry filter to view the background grid geometryFilter = vtk.vtkRectilinearGridGeometryFilter() geometryFilter.SetInputData(rgrid) geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2) geometryFilter.Update() # ================ END creating a plane =======================
The code that merge the stl poly data and the plane:
meshAppend = vtk.vtkAppendPolyData() meshAppend.AddInputData(stl_poly_data) meshAppend.AddInputData(geometryFilter.GetOutput()) meshAppend.Update() boundaryClean = vtk.vtkCleanPolyData() boundaryClean.SetInputData(meshAppend.GetOutput()) boundaryClean.Update() out = vtk.vtkPolyData() out.DeepCopy(boundaryClean.GetOutput()) triangleTrans = vtk.vtkTriangleFilter() triangleTrans.SetInputData(out) triangleTrans.Update() fill = vtk.vtkFillHolesFilter() fill.SetInputData(out) fill.SetHoleSize(1000000.0) fill.Update()
How to use the python interpreter while another python process is running?
I use Python 3.6 and start a process in my script (VTK Visualization). Until I close the visualization window the command line is blocked which I want to change. I read something about multiprocessing and threading, but I'm not sure which is the right approach.
This is what I want to achieve and my ideas:
- start two processes (visualization window and a loop for inputs)
- with exec(input) the inputs are written into my script
- after that the visualization window is updated
I am thankful for any advice on which method could be suitable for my intend!
Edit: I tried threading and started both threads, but still the command line was blocked until I closed the window and just opened up again after typing in an input.. Is there anyone who achieved something similar before?
Python3- mayavi2, reading values
I am a new user on mayavi2 user interface.
I have a data text file containing 6 parameters:
I can load data by : File -> Load data -> Open file.
I would like to plot the position and add a color map according to Fy. I don't find where I could specify the data that mayavi should read.
Importing mlab from mayavi or vtk : the kernel died
I have tried installing mayavi for several days, without results. I'm using spyder and anaconda. I can import mayavi on spyder without problem, but when I try importing vtk or from mayavi import mlab, the kernel died. I read a lot on the subject without finding a solution that work. I try all backend (Online, Qt4 and Qt5) without result. I'm still new to Python so I'm not quite sure if I did all the installation right.
To install mayavi I use :
$conda config --add channels conda-forge
$conda install mayavi
I also try to use
$ pip install mayavibut I get another error that I was not able to solve : Command "python setup.py egg_info" failed with error code 1. (which I also try to solve without result doing all the update recommended)
I try these tests :
$nosetests -v tvtk/testsERROR: Failure: OSError
$nosetests -v mayaviok
System infos (Windows 10)
- anaconda 5.2.0
- conda 4.5.7
- mayavi 4.6.1
- PyQt5 5.11.2
- python 3.6.5
- spyder 3.2.8
- vtk 8.1.0
If someone has a solution that would be great!
mayavi number of colors and custom colorscale
I have a matrix out[mXnXp], that have coordinates from a grid
I want to plot each "layer" individual, so in the editor I can show/hide individual layers (say Want to see only out[:,:,3] and out[:,:,4]...)
I plot with the following
myfig = mlab.figure(1, fgcolor=(1, 1, 1), bgcolor=(0, 0, 0)) for k in range(0,10): xx, yy, zz = np.where(zc2==zs[k]) pp=mlab.points3d(xc2[xx,yy,zz], yc2[xx,yy,zz], zc2[xx,yy,zz],out[xx,yy,zz], mode="cube", scale_factor=100,scale_mode='none',vmin=0,vmax=8)
Now, I want to define a custom colorscale, which has only 10 discrete colors. So I have a matrix
imod =[R,G,B,A] of size [10,4] pp.module_manager.scalar_lut_manager.lut.table=imod
But this doesn't work. I believe myavi expects tham imod is of size[256,4]
How can I limit the number of colors in the colorscale and define the ones I need?