code to rtieve a a downsample of a 128*128*128  matrix of integer values and the intermediate steps