Reading all images(jpg) from a folder by using imageio.readvol()

1.5k Views Asked by At

I can read all the *.dcm files from "imgs" with this command

vol = imageio.volread("imgs")

but I can't read jpg files. My image files has *.bmp.jpg extension (e.g. C001_IMG00023.bmp.jpg) and

histology = imageio.volread("imgs", "jpg")

command gave me

RuntimeError: Format JPEG-PIL cannot read in mode 'v'

then I read the docs and tried this command

histology = io.volread("imgs",mode="L", "jpg")

but it gave me this error

SyntaxError: positional argument follows keyword argument

I searched for the errors and about reading jpg files with imageio but i couldn't find anything about it. Is it possible to read image files from a folder with imageio or should I use different method for it? I want to read files with simple command like above.

1

There are 1 best solutions below

0
On BEST ANSWER

You can always go for skimage,

from skimage.io import imread_collection
path= 'imgs/*.jpg'
histology=imread_collection(path)