im <- as.cimg(function(x,y,z) x+y+z,10,10,5)
imsplit(im,"z") #Split along the z axis into a list with 5 elements
imsplit(im,"z",2) #Split along the z axis into two groups
imsplit(im,"z",2) %>% imappend("z") #Split and reshape into a single image
Run the code above in your browser using DataLab