Reputation: 1
I have several 2D images, and want to convert these slices to a 3D image with python. i found the next code, and I don't not know what exactly I have done worng...
from skimage import io
im_collection = io.imread_collection('C:/Users/Itzik/Desktop/images/*.tiff')
im_3d = im_collection.concatenate()
This is the error message that I got:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\anaconda3\envs\Segmentation 3D\lib\site-packages\skimage\io\collection.py in concatenate_images(ic)
45 ar = np.concatenate(all_images)
46 except ValueError:
---> 47 raise ValueError('Image dimensions must agree.')
48 return ar
49
~\anaconda3\envs\Segmentation 3D\lib\site-packages\skimage\io\collection.py in <listcomp>(.0)
45 ar = np.concatenate(all_images)
46 except ValueError:
---> 47 raise ValueError('Image dimensions must agree.')
48 return ar
49
~\anaconda3\envs\Segmentation 3D\lib\site-packages\tifffile\tifffile.py in __init__(self, arg, name,
offset, size, multifile, _useframes, **kwargs)
2179 setattr(self, key, bool(value))
2180 else:
-> 2181 raise TypeError(f'unexpected keyword argument: {key}')
2182
2183 fh = FileHandle(arg, mode='rb', name=name, offset=offset, size=size)
TypeError: unexpected keyword argument: img_num
Upvotes: 0
Views: 851
Reputation: 5768
We finally figured this out on the scikit-image issue tracker. The fix is to specify the tifffile plugin:
from skimage import io
im_collection = io.imread_collection(
'C:/Users/Itzik/Desktop/images/*.tiff', plugin='tifffile'
)
im_3d = im_collection.concatenate()
Upvotes: 1