title: mayavi - setting the [x,y,z] extent of an image programatically
body: <p>I have some data that consists of several 2D images that I would like to render in specific [x,y,z] positions relative to one another using <code>mayavi2 (v4.3.0)</code>.</p>
  
  <p><a href="http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html#mayavi.mlab.imshow">From the documentation</a> it seems that I should just be able to do this with <code>mlab.imshow()</code>. Unfortunately, mayavi throws an exception when I call <code>imshow</code> specifying the <code>extent</code> parameter (<code>AttributeError: 'ImageActor' object has no attribute 'actor'</code>).</p>
  
  <p>I also tried setting the x,y and z data directly by modifying <code>im.mlab_source.x,y,z...</code>. Weirdly, whilst this correctly changes the x and y extents, it does nothing to the z-position even though <code>im.mlab_source.z</code> clearly changes.</p>
  
  <p>Here's a runnable example:</p>
  
  <pre><code>import numpy as np
  from scipy.misc import lena
  from mayavi import mlab
  
  def normal_imshow(img=lena()):
      return mlab.imshow(img,colormap='gray') 
  
  def set_extent(img=lena()):
      return mlab.imshow(img,extent=[0,100,0,100,50,50],colormap='cool')
  
  def set_xyz(img=lena()):
      im = mlab.imshow(img,colormap='hot')    
      src = im.mlab_source
      print 'Old z :',src.z
      src.x = 100*(src.x - src.x.min())/(src.x.max() - src.x.min())
      src.y = 100*(src.y - src.y.min())/(src.x.max() - src.y.min())
      src.z[:] = 50
      print 'New z :',src.z
      return im
  
  if __name__ == '__main__':
  
      # this works
      normal_imshow()
  
      # # this fails (AttributeError)
      # set_extent()
  
      # weirdly, this seems to work for the x and y axes, but does not change
      # the z-postion even though data.z does change
      set_xyz()
  </code></pre>