For a double pointer you have to allocate memory for first as well as second dimension.
For the second level instead of allocating memory for every dimension he allocates memory at one shot
MatrixBuffers[0] = new double[header.img* 12];
Inside the for loop they move the address and assign the same to every index.
Instead he can also do like this inside the for loop and comment the line above the for loop
MatrixBuffers[i] = new double[header.img];