title: How create a sphere image with smooth boudaries
body: <p>Trying to create a ghost 3d image with a known volume to create a calibrated gold standard : a sphere.</p>
  
  <p>I've tried this code but it doesn't provide me what i'm really want.</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  import medpy.io as mdpy
  from scipy import signal
  
  def create_bin_sphere(arr_size, center, r):
      coords = np.ogrid[:arr_size[0], :arr_size[1], :arr_size[2]]
      distance = np.sqrt((coords[0] - center[0])**2 + (coords[1]-center[1])**2 + (coords[2]-center[2])**2) 
      return 10*(distance &lt;= r)
  
  
  arr_size = (100,100,100)
  sphere_center = (50,50,50)
  r=30
  sphere = create_bin_sphere(arr_size,sphere_center, r)
  
  
  kernel = np.array([[[0,1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,0]]])
  sphere_smooth = scipy.signal.oaconvolve(sphere, kernel, mode="same")
  from medpy.io import load, save
  save(sphere_smooth ,r'x\x\x\x\x\sphere_smooth.mhd')
  </code></pre>
  
  <p>Does not work as i wish :<a href="https://i.stack.imgur.com/HwsTR.png" rel="nofollow noreferrer">image in itk snap in x plan</a></p>
  
  <p>I would rather not change the sphere shape (the "smoothed" become ovoid), have the blurr effect on the whole circumference and reducing its thickness, and finally invert the density (white outside and grey inside the sphere).</p>
  
  <p>If you can help me i will appreciate... </p>