Moved slicer.cpp code into slicer.hpp so that it could be used as header-only code.