initial cpp version of image slicer