Converts the whole raster into an array and allows the user to compute a chosen statistic
for every different class inside the raster.