Closed yongshuo-Z closed 3 years ago
Hi,
I am reading a MetaMorph stk file that contains a series of cryo-EM images, which contain 50 images.
Here is the code;
import tifffile stk = tifffile.imread('particles_export.stk')
it returns an error:
KeyError Traceback (most recent call last) /opt/anaconda3/envs/cryo/lib/python3.6/site-packages/tifffile/tifffile.py in __init__(self, arg, name, offset, size, _multifile, _useframes, _master, **kwargs) 2754 try: -> 2755 byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]] 2756 except KeyError: KeyError: b'\x00\x00' During handling of the above exception, another exception occurred: TiffFileError Traceback (most recent call last) <ipython-input-25-d5856ab518a1> in <module>() 4 5 ----> 6 stk = tifffile.imread(filename) 7 #stk = imageio.mimread(filename, format = 'SPIDER' ,is_stk = True) /opt/anaconda3/envs/cryo/lib/python3.6/site-packages/tifffile/tifffile.py in imread(files, aszarr, **kwargs) 710 711 if isinstance(files, (str, os.PathLike)) or hasattr(files, 'seek'): --> 712 with TiffFile(files, **kwargs_file) as tif: 713 if aszarr: 714 return tif.aszarr(**kwargs) /opt/anaconda3/envs/cryo/lib/python3.6/site-packages/tifffile/tifffile.py in __init__(self, arg, name, offset, size, _multifile, _useframes, _master, **kwargs) 2755 byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]] 2756 except KeyError: -> 2757 raise TiffFileError('not a TIFF file') 2758 2759 version = struct.unpack(byteorder + 'H', header[2:4])[0] TiffFileError: not a TIFF file
I am wondering how can I read this file? I want to save the images as several single tiff files.
You may find this file here. I've checked the stk file with ImageJ. It works fine, so the file is not corrupted.
Thanks for any advice.
The file is not a MetaMorph STK or TIFF file. It's a SPIDER file, which can be read (for example) with Pillow.
Hi,
I am reading a MetaMorph stk file that contains a series of cryo-EM images, which contain 50 images.
Here is the code;
it returns an error:
I am wondering how can I read this file? I want to save the images as several single tiff files.
You may find this file here. I've checked the stk file with ImageJ. It works fine, so the file is not corrupted.
Thanks for any advice.