title: 3d coordinates x,y,z to 3d numpy array
body: <p>I have a 3d mask which is an ellipsoid. I have extracted the coordinates of the mask using <code>np.argwhere</code>. The coordinates can be assigned as x, y, z as in the example code. My question is how can I get my mask back (in the form of 3d numpy or boolean array of the same shape) from the coordinates x, y, z ?</p>
  
  <pre><code>import numpy as np
  import scipy
  import skimage
  from skimage import draw
  
  mask = skimage.draw.ellipsoid(10,12,18)
  print mask.shape 
  
  coord = np.argwhere(mask)
  
  x = coord[:,0]
  y = coord[:,1]
  z = coord[:,2]
  </code></pre>
  
  <p>The above code gives me boolean mask of the shape (23, 27, 39) and now I want to construct the same mask of exactly same shape using x, y, z coordinates. How can it be done?</p>
  
  <p>I would like to modify the question above a bit. Now if I rotate my coordinates using quaternion which will give me new set of coordinates and then with new coordinates x1,y1,z1 I want to construct my boolean mask of shape (23,27,39) as that of original mask ? How can that be done ?</p>
  
  <pre><code>import quaternion
  angle1 = 90
  rotation = np.exp(quaternion.quaternion(0,0, 1) * angle1*(np.pi/180) / 2)
  coord_rotd = quaternion.rotate_vectors(rotation, coord)
  x1 = coord_rotd[:,0]
  y1 = coord_rotd[:,1]
  z1 = coord_rotd[:,2]
  </code></pre>