question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError using imagej_metadata

See original GitHub issue

When opening a file made with Fiji, I get the following error although the data are correctly loaded:

TiffPage 0: TypeError: read_bytes() missing 3 required positional arguments: ‘dtype’, ‘count’, and ‘offsetsize’

The traceback yields this:

File “/opt/homebrew/lib/python3.9/site-packages/tifffile/tifffile.py”, line 3099, in init self.pages = TiffPages(self) File “/opt/homebrew/lib/python3.9/site-packages/tifffile/tifffile.py”, line 5269, in init page = TiffPage(self.parent, index=pageindex) File “/opt/homebrew/lib/python3.9/site-packages/tifffile/tifffile.py”, line 5893, in init tags[50839].value = imagej_metadata( File “/opt/homebrew/lib/python3.9/site-packages/tifffile/tifffile.py”, line 14845, in imagej_metadata values.append(func(data[pos:pos1], byteorder)) File “/opt/homebrew/lib/python3.9/site-packages/tifffile/tifffile.py”, line 13960, in read_bytes

The method read_bytes is called in imagej_metadata without the last three arguments.

Minimum working example (use enclosed file: triple-sphere.zip):

import tifffile

with tifffile.TiffFile("/foo/bar/data.tif") as tf:
    data = tf.asarray()

Expected output: I have not notice anything wrong except the error being displayed. The data are correctly loaded in memory and returned by tf.asarray.

Versions:

  • tifffile: 2021.10.12
  • python: 3.9.7

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cgohlkecommented, Nov 2, 2021

Fixed in v2021.11.2

0reactions
psratlcommented, Jun 2, 2022

I had previously tried a conda update conda command.

Check out this conda update tifffile result: (base) C:\Users*****>conda update tifffile Collecting package metadata (current_repodata.json): done Solving environment: | Updating tifffile is constricted by anaconda -> requires tifffile==2021.4.8=pyhd3eb1b0_2 If you are sure you want an update of your package either try conda update --all or install a specific version of the package you want using conda install <pkg>=<version>

All requested packages already installed.

Here’s a guy with a similar problem, and it suggests perhaps I need square images. https://github.com/HenriquesLab/ZeroCostDL4Mic/issues/86

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pims "Unexpected Keyword Argument" and “invalid ImageJ ...
The Context: I'm trying to use the package trackpy for research. I'm on a Mac and I'm using (mostly) Spyder. I'm following the...
Read more >
OME / bio-formats / Metadata type error - Image.sc Forum
Hello everybody, I'm trying to get the timing metadata from an image by duplicating this example: However, on my code, I get a...
Read more >
Metadata - ImageJ Wiki
Metadata is essential to correctly read image data; for example, to have accurate measurements, the image needs to be calibrated according to the...
Read more >
tifffile - PyPI
Tifffile is a Python library to. store NumPy arrays in TIFF (Tagged Image File Format) files, and. read image and metadata from TIFF-like...
Read more >
MetaData - ImageJ
A metapicture is a single image and its associated metadata. They are saved as tiff files with the metadata contained in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found