Display several 2d image as a stack in R

How to display stack of several 2d images to form as 3d image in R ? If anyone can share the code with the example it would be very helpful.enter link description here

1 answer

  • answered 2018-10-11 20:28 Jon Spring

    See the vignette for the magick package. https://github.com/ropensci/magick/blob/master/vignettes/intro.Rmd

    Under Image Vectors - Combining, it shows how to combine multiple layers with an offset. It sounds like you'd do something like:

    library(magick)
    combo <- image_composite(layer1, layer2, offset = "+0+50")
    combo <- image_composite(combo , layer3, offset = "+0+50")
    combo <- image_composite(combo , layer4, offset = "+0+50")