I'm searching for an algorithm to merge a given number of multidimensional arrays (each of the same shape) to a given proportion (x,y,z).
For example 4 arrays with the shape (128,128,128) and the proportion (1,1,4) to an array of the shape (128,128,512). Or 2 arrays with the shape (64,64,64) and the proportion (1,2,1) to an array of the shape (64,128,64)
I know how to do it manually with np.concatenate
, but I need a general algorithm to do this. (np.reshape
doesn't work - this will mess up the order)
edit: It's possible that the proportion is (1,2,3), then it is necessary to compare the left_edge of the box, to know where to place it. every array have a corresponding block with the attribute left_edge (xmin, ymin, zmin). Can I solve this with a if-condition?