Is there any way to read one image row/column into an array in Python? -


i've translated ct reconstruction software idl python, , first experience ever python. code works fine except it's much, slower. due, in part, fact idl allows me save memory , time reading in 1 row of image @ time, using following:

image = read_tiff(filename, sub_rect = [0, slice, x, 1]) 

i need read 1 row each 1800 different projection images, far can tell can create image array reading in entire image , converting array. there trick read in 1 row start, since don't need other 2047 rows?

it looks tifffile.py christoph gohlke (http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html) can job.

from tiffile import tifffile  tifffile('test.tiff') tif:     page in tif:         image = page.asarray(memmap=true)         print image[0,:,:] 

if interpret code correctly extract first row of every page in file without loading whole file memory (through numpy.memmap).


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -