Better shape handling and remove tifffile.py dependence