In my program I current create a numpy array full of zeros and then for loop through each element replacing it with the desired value. Is there a more efficient way of doing this?
Below is an example of what I am doing however, instead of a int I have a list of each row which needs put into the numpy array. Is there a way to put replace whole rows and is that more efficient.
import numpy as np
from tifffile import imsave
image = np.zeros((5, 2160, 2560), 'uint16')
num =0
for pixel in np.nditer(image, op_flags=['readwrite']):
pixel = num
num += 1
imsave('multipage.tif', image)