API docs

ipyvolume.volume

ipyvolume.volume.quickvolshow(data, lighting=False, data_min=None, data_max=None, tf=None, stereo=False, width=400, height=500, ambient_coefficient=0.5, diffuse_coefficient=0.8, specular_coefficient=0.5, specular_exponent=5, downscale=1, level=[0.1, 0.5, 0.9], opacity=[0.01, 0.05, 0.1], level_width=0.1, **kwargs)[source]

Visualize a 3d array using volume rendering

Parameters:
  • data – 3d numpy array
  • lighting – boolean, to use lighting or not, if set to false, lighting parameters will be overriden
  • data_min – minimum value to consider for data, if None, computed using np.nanmin
  • data_max – maximum value to consider for data, if None, computed using np.nanmax
  • tf – transfer function (see ipyvolume.transfer_function, or use the argument below)
  • stereo – stereo view for virtual reality (cardboard and similar VR head mount)
  • width – width of rendering surface
  • height – height of rendering surface
  • ambient_coefficient – lighting parameter
  • diffuse_coefficient – lighting parameter
  • specular_coefficient – lighting parameter
  • specular_exponent – lighting parameter
  • downscale – downscale the rendering for better performance, for instance when set to 2, a 512x512 canvas will show a 256x256 rendering upscaled, but it will render twice as fast.
  • level – level(s) for the where the opacity in the volume peaks, maximum sequence of length 3
  • opacity – opacity(ies) for each level, scalar or sequence of max length 3
  • level_width – width of the (gaussian) bumps where the opacity peaks, scalar or sequence of max length 3
  • kwargs – extra argument passed to Volume and default transfer function
Returns:

ipyvolume.volume.quickscatter(x, y, z, **kwargs)[source]
ipyvolume.volume.quickquiver(x, y, z, u, v, w, **kwargs)[source]
ipyvolume.volume.volshow(*args, **kwargs)[source]

Deprecated: please use ipyvolume.quickvol or use the ipyvolume.pylab interface

ipyvolume.pylab

ipyvolume.pylab.scatter(x, y, z, color='red', s=0.02, ss=0.026000000000000002, color_selected='white', marker='diamond', selection=None, **kwargs)[source]

Create a scatter 3d plot with

Parameters:
  • x – 1d numpy array with x positions
  • y
  • z
  • color – string format, examples for red:’red’, ‘#f00’, ‘#ff0000’ or ‘rgb(1,0,0)
  • s – float representing the size of the glyph in fraction of the viewport, where 1. is full viewport
  • ss – like size, but for selected glyphs
  • color_selected – like color, but for selected glyphs
  • marker – name of the marker, options are: ‘arrow’, ‘box’, ‘diamond’, ‘sphere’
  • selection – array with indices of x,y,z arrays of the selected markers, which can have a different size and color
  • kwargs
Returns:

ipyvolume.pylab.quiver(x, y, z, u, v, w, s=0.2, ss=0.26, color='red', color_selected='white', marker='arrow', **kwargs)[source]

Create a quiver plot, which is like a scatter plot but with arrows pointing in the direction given by u, v and w

Parameters:
  • x – {x}, for convenience the array is flattened if not 1d.
  • y
  • z
  • u – {u}
  • v
  • w
  • s – {size}
  • ss – like size, but for selected glyphs
  • color – {color}
  • color_selected – like color, but for selected glyphs
  • marker – (currently only ‘arrow’ would make sense)
  • kwargs
Returns:

ipyvolume.pylab.volshow(data, lighting=False, data_min=None, data_max=None, tf=None, stereo=False, ambient_coefficient=0.5, diffuse_coefficient=0.8, specular_coefficient=0.5, specular_exponent=5, downscale=1, level=[0.1, 0.5, 0.9], opacity=[0.01, 0.05, 0.1], level_width=0.1, controls=True)[source]

Visualize a 3d array using volume rendering.

Currently only 1 volume can be rendered.

Parameters:
  • data – 3d numpy array
  • lighting – boolean, to use lighting or not, if set to false, lighting parameters will be overriden
  • data_min – minimum value to consider for data, if None, computed using np.nanmin
  • data_max – maximum value to consider for data, if None, computed using np.nanmax
  • tf – transfer function (or a default one)
  • stereo – stereo view for virtual reality (cardboard and similar VR head mount)
  • ambient_coefficient – lighting parameter
  • diffuse_coefficient – lighting parameter
  • specular_coefficient – lighting parameter
  • specular_exponent – lighting parameter
  • downscale – downscale the rendering for better performance, for instance when set to 2, a 512x512 canvas will show a 256x256 rendering upscaled, but it will render twice as fast.
  • level – level(s) for the where the opacity in the volume peaks, maximum sequence of length 3
  • opacity – opacity(ies) for each level, scalar or sequence of max length 3
  • level_width – width of the (gaussian) bumps where the opacity peaks, scalar or sequence of max length 3
  • controls – add controls for lighting and transfer function or not
Returns:

ipyvolume.pylab.xlim(xmin, xmax)[source]

Set limits of x axis

ipyvolume.pylab.ylim(ymin, ymax)[source]

Set limits of y axis

ipyvolume.pylab.zlim(zmin, zmax)[source]

Set limits of zaxis

ipyvolume.pylab.xyzlim(vmin, vmax)[source]

Set limits or all axis the same

ipyvolume.pylab.figure(key=None, width=400, height=500, lighting=True, controls=True, debug=False)[source]

Create a new figure (if no key is given) or return the figure associated with key

Parameters:
  • key – Python object that identifies this figure
  • width – pixel width of WebGL canvas
  • height
  • lighting – use lighting or not
  • controls – show controls or not
  • debug – show debug buttons or not
Returns:

ipyvolume.pylab.gcf()[source]

Get current figure, or create a new one

ipyvolume.pylab.clear()[source]

Remove current figure (and container)

ipyvolume.pylab.show()[source]

Display (like in IPython.display.dispay(...) the current figure

ipyvolume.pylab.transfer_function(level=[0.1, 0.5, 0.9], opacity=[0.01, 0.05, 0.1], level_width=0.1, controls=True)[source]

Create a transfer function, see volshow