How to color a 3d grayscale image in python
<p>I want to color a pixel in 3d</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
im = np.random.randint(0, 255, (16, 16))
I = np.dstack([im, im, im])
x = 5
y = 5
I[x, y, :] = [1, 0, 0]
plt.imshow(I, interpolation='nearest' )
plt.imshow(im, interpolation='nearest', cmap='Greys')
</code></pre>

<p>This code is for 2d but instead of the coordiantes i want to give the value of the grayscale pixel in 3d that i want to change.</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
np.random.seed(4)
im = np.random.randint(0, 255, (16, 16))
I = np.dstack([im, im, im])
I[np.logical_and(np.logical_and(I[:, :, 0]==15, I[:, :, 1]==15), I[:, :, 2]==15)] = [0, 1, 0]
plt.figure()
plt.imshow(I, interpolation='nearest' )
plt.figure()
plt.imshow(im, interpolation='nearest', cmap='Greys')
plt.show()
</code></pre>

python image image-processing grayscale