blink1073 / tifffile

Deprecated: Read and write image data from and to TIFF files.
Other
61 stars 41 forks source link

OME Series: In 'modulo' tags, allow non-integer Start/End/Step attributes #17

Closed stuarteberg closed 7 years ago

stuarteberg commented 8 years ago

Here's a snippet of metadata from an OME-TIFF file that was created by the BioFormats bfconvert tool:

<XMLAnnotation ID="Annotation:11" Namespace="openmicroscopy.org/omero/dimension/modulo">
   <Value>
      <Modulo namespace="http://www.openmicroscopy.org/Schemas/Additions/2011-09">
         <ModuloAlongC End="1.0" Start="0.0" Step="1.0" Type="other" TypeDescription="TCSPC" />
      </Modulo>
   </Value>
</XMLAnnotation>

Unfortunately, tifffile.py chokes[1] on the attribute Start="0.0", because it expects an int, not a float. I asked about this on the ome-devel mailing list[2], and I was told that this metadata from bfconvert is correct. Therefore, here's a little PR to tifffile.py, to allow float in that attribute.

[1]: For the record, the error from tifffile.py is the following:

  File "/Users/bergs/Documents/workspace/ilastik-meta/lazyflow/lazyflow/operators/ioOperators/opTiffReader.py", line 47, in setupOutputs
    series = tiff_file.series[0]
  File "/miniconda2/envs/ilastik-new/lib/python2.7/site-packages/tifffile/tifffile.py", line 1177, in __get__
    value = self.func(instance)
  File "/miniconda2/envs/ilastik-new/lib/python2.7/site-packages/tifffile/tifffile.py", line 1494, in series
    series = self._ome_series()
  File "/miniconda2/envs/ilastik-new/lib/python2.7/site-packages/tifffile/tifffile.py", line 1672, in _ome_series
    int(along.attrib['Start']),
ValueError: invalid literal for int() with base 10: '0.0'

[2]: http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2016-July/003723.html

jakirkham commented 7 years ago

cc @cgohlke

stuarteberg commented 7 years ago

Oops, I should have closed this PR already. @cgohlke has already included this fix in his master copy, as of revision 2016.10.28: http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html

Once @blink1073 updates this repo to merge @cgohlke's latest version, then this repo will have the fix, too.

jakirkham commented 7 years ago

The reason this probably hasn't been updated is there hasn't been a PyPI release.

blink1073 commented 7 years ago

The PyPI releases are sourced from this repository, I need to update here for the new source version and cut a release, thank you for the heads up.

jakirkham commented 7 years ago

Sorry I misspoke. I often forget how this repo and releases relate to the source.

blink1073 commented 7 years ago

Released in 0.10.

jakirkham commented 7 years ago

Thanks. Bumping the version in conda-forge.

xref: https://github.com/conda-forge/tifffile-feedstock/pull/8