Reputation: 1
I need to read tiff images into a NumPy array. However, as much as I would like to use PIL/Pillow, or MatPlotLib, to do this, I cannot. I am limited to the base python modules in python 2.6, since that is what is installed on the system that will execute on and I do not have sufficient privileges to install new modules or upgrade python. Is this going to be possible in any reasonable form?
Upvotes: 0
Views: 275
Reputation: 1144
First, don't mess with the system Python or complain that you cannot. That is just an imaginary problem. Whether you are using Linux or Mac, the system Python encironment is needed by the operating system. Even if you did have sudo rights you shouldn't touch it because the integrity of the operating system depends on it. Leave it alone and stop worrying about it. In El Capitan Apple has even put in a special protection layer to make sure the system Python is not modified, even by those who would otherwise have rights to do so.
What you should do it to install a clean Python environment (e.g. Anaconda) into a local folder in your home directory. You don't need any special access rights to do this, just read/write access to your home directory or your documents folder. If you can create and save files somewhere you have all the rights to need. Add the folder containing yor private Python interpreter to your path so it appears before the system Python and it will take presedence.
The best tool to read TIFF files is Christoph Gohlke's Tifffile module. You don't need to install anything, just dump Tifffile.py in your project. You can optionally compile Tiffile.c for faster decoding of LZW data, but it is not needed. This does not require any installation either.
http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html http://www.lfd.uci.edu/~gohlke/code/tifffile.c.html
Tifffile does require at least Python 2.7, though, as do most Python tools nowadays, which is another reason you want to set up a local Python environment.
Upvotes: 1