moved toRasterData from companion object to class