(First time user)
I want to read tif files from a folder.
N=22 (the number of tif files in the folder)
The name of the folder is: tif_files
The file names start at E_0 and ends at E_21
I'm reading the folder using:
for i in range(N):
im = imageio.imread(path + tifFiles[i])
I get N from:
N = len(tifFiles)
which gives me 22
I get tifFiles using:
tifFiles = sorted([f for f in listdir(path) if isfile(join(path, f))])
The path is:
'/Users/name/rsm/tif_files/'
print(im.shape) gives me (514, 1030, 4) {I'm expecting it to be (514 1030 22)}
If I print the output list of the files (tifFiles) it gives me the 22 files:
print(tifFiles)
['E_0.tif', 'E_1.tif', 'E_10.tif', 'E_11.tif', 'E_12.tif', 'E_13.tif', 'E_14.tif', 'E_15.tif', 'E_16.tif', 'E_17.tif', 'E_18.tif', 'E_19.tif', 'E_2.tif', 'E_20.tif', 'E_21.tif', 'E_3.tif', 'E_4.tif', 'E_5.tif', 'E_6.tif', 'E_7.tif', 'E_8.tif', 'E_9.tif']
I put all of this in a function:
function(path,filename)
note: filename is used further downstream in the function to describe the output files of the images
- I made sure that I'm in the right path (not reading from somewhere else).
- I tried using tiff files instead of tif files.
- I changed the files names from "E_0" to "E0" to discard the use of the underscore
So I have to get 22 arrays of (514 1030) pixels but I'm getting only 4.