

'============================================'

os.chdir('/home/t.kuipers/Documents/PhD/Fractal Dithering project/input images/gradient_3D')


s=512
gradient = np.zeros(s*s*s, dtype=np.uint8).reshape(s,s,s)
for x in range(0, s):
  for y in range(0, s):
    for z in range(0, s):
      gradient[x,y,z] = (x + y + z) * 255 / (3 * (s-1))

for z in range(0, s):
  im = Image.fromarray(gradient[:,:,z].astype('uint8'), 'L')
  im.save("gradient_3D_" + str(z) + ".PNG")






'============================================'

os.chdir('/home/t.kuipers/Documents/PhD/Fractal Dithering project/input images/contrast_plane')


s=512
gradient = np.zeros(s*s*s, dtype=np.uint8).reshape(s,s,s)
for x in range(0, s):
  for y in range(0, s):
    for z in range(0, s):
      x_ = x - s / 2
      y_ = y - s / 2
      z_ = z - s / 2
      gradient[x,y,z] = 255 * min(1, max(0, 1 * (-.92 * x_ + 0.38 * y_ + z_)))

for z in range(0, s):
  im = Image.fromarray(gradient[:,:,z].astype('uint8'), 'L')
  im.save("contrast_plane_" + str(z) + ".PNG")











'============================================'

os.chdir('/home/t.kuipers/Documents/PhD/Fractal Dithering project/input images/sphere_shell')

s=512
t=s/7
r=s/2-t/2
gradient = np.zeros(s*s*s, dtype=np.uint8).reshape(s,s,s)
for x in range(0, s):
  for y in range(0, s):
    for z in range(0, s):
      x_ = x - s / 2
      y_ = y - s / 2
      z_ = z - s / 2
      dist = abs(math.sqrt(x_ * x_ + y_ * y_ + z_ * z_) - r)
      gradient[x,y,z] = 255 * min(1, max(0, dist - t/2))

for z in range(0, s):
  im = Image.fromarray(gradient[:,:,z].astype('uint8'), 'L')
  im.save("sphere_shell_" + str(z) + ".PNG")




