Hi @albanD, I’ve been thinking about this reply a lot and I think I may have a way to do it but I thought I’d run it by you as initial tests have shown that the gradient tree is still broken somewhere.
So my crazy idea looks as follows:

image1512×465 49.2 KB

Where I and S are flattened replacements of the 2D arrays as seen in the previous post.
Now instead of indexing, the indices from I are used at the mean values of a series of normal distributions evaluated over the 2D array with dimensions N by x^2, and using some predefined σ.
Then a simple reshaping turns this 2D array back into the original cube shape.
As there is no indexing here, I shouldn’t think it would break the gradient tree…but is there something very obvious I’ve missed that you think would cause this method to fail?

Note: One can think of the 2D array (with dimensions N by x^2) as a flattened version of a cube where each row represents the channel indices of a cube spaxel C_ij. Pictorially this looks as follows:

…where the maximum value of C_ij is normally distributed about I_ij with size S_ij.