These are chat archives for thunder-project/thunder

May 2016
Joe Baines-Holmes
May 24 2016 09:47

I'm getting an issue loading ome-tifs into thunder:

UnboundLocalError                         Traceback (most recent call last)
<ipython-input-9-eed51476f58a> in <module>()
----> 1 data = td.images.fromtif('./test-tif/')

/home/ec2-user/anaconda2/lib/python2.7/site-packages/thunder/images/readers.pyc in fromtif(path, ext, start, stop, recursive, nplanes, npartitions, labels, engine, credentials)
    371     return frompath(path, accessor=getarray, ext=ext, start=start, stop=stop,
    372                     recursive=recursive, npartitions=npartitions, recount=recount,
--> 373                     labels=labels, engine=engine, credentials=credentials)
    375 def frompng(path, ext='png', start=None, stop=None, recursive=False, npartitions=None, labels=None, engine=None, credentials=None):

/home/ec2-user/anaconda2/lib/python2.7/site-packages/thunder/images/readers.pyc in frompath(path, accessor, ext, start, stop, recursive, npartitions, dims, dtype, labels, recount, engine, credentials)
    205     else:
    206         if accessor:
--> 207             data = [accessor(d) for d in data]
    208         flattened = list(itertools.chain(*data))
    209         values = [kv[1] for kv in flattened]

/home/ec2-user/anaconda2/lib/python2.7/site-packages/thunder/images/readers.pyc in getarray(idxAndBuf)
    351         fbuf = BytesIO(buf)
    352         tfh = tifffile.TiffFile(fbuf)
--> 353         ary = tfh.asarray()
    354         pageCount = ary.shape[0]
    355         if nplanes is not None:

/home/ec2-user/anaconda2/lib/python2.7/site-packages/skimage/external/tifffile/tifffile.pyc in asarray(self, key, series, memmap)
    998             series = 0
    999         if series is not None:
-> 1000             pages = self.series[series].pages
   1001         else:
   1002             pages = self.pages

/home/ec2-user/anaconda2/lib/python2.7/site-packages/skimage/external/tifffile/tifffile.pyc in __get__(self, instance, owner)
    712         if instance is None:
    713             return self
--> 714         value = self.func(instance)
    715         if value is NotImplemented:
    716             return getattr(super(owner, instance), self.func.__name__)

/home/ec2-user/anaconda2/lib/python2.7/site-packages/skimage/external/tifffile/tifffile.pyc in series(self)
    882         if self.is_ome:
--> 883             series = self._omeseries()
    884         elif self.is_fluoview:
    885             dims = {b'X': 'X', b'Y': 'Y', b'Z': 'Z', b'T': 'T',

/home/ec2-user/anaconda2/lib/python2.7/site-packages/skimage/external/tifffile/tifffile.pyc in _omeseries(self)
   1165                                 tif = TiffFile(os.path.join(dirname, fname))
   1166                             except (IOError, ValueError):
-> 1167                                 tif.close()
   1168                                 warnings.warn(
   1169                                     "ome-xml: failed to read '%s'" % fname)

UnboundLocalError: local variable 'tif' referenced before assignment

Has anyone seen this before? I'm getting it when I try and load locally, or from s3 using both the default engine and spark.

Joe Baines-Holmes
May 24 2016 09:56
If I knock out the tif.close() statement in I get hundreds of warnings of the form:
anaconda2/lib/python2.7/site-packages/skimage/external/tifffile/ UserWarning: ome-xml: failed to read '1_2_T{index}.ome.tif'
  "ome-xml: failed to read '%s'" % fname)
where {index = 1,2,...}
May 24 2016 10:16
@freeman-lab I am new to the thunder project. I am curious and I would like to know more. Where can I find short tutorials?
Joe Baines-Holmes
May 24 2016 10:58
I've opened this up as issue #318.
@evaristoc, have you tried
There are a few tutorials there
Jason Wittenbach
May 24 2016 13:21
@bainzo Thunder uses tifffile (found inside of the scikit-learn package) to read TIFs. Looks like this might just be an upstream problem with tifffile not being able to handle these types of files.
Can you load such a file with tifffile outside of Thunder?
Something like:
from skimage.external.tifffile import imread
img = imread(‘/path/to/image.tif’)
This message was deleted
Joe Baines-Holmes
May 24 2016 14:43
@jwittenbach I think you are right. I retested after saving the file as a regular TIF using ImageJ and it worked with the default engine. I'm away from work but I will try this later
Jeremy Freeman
May 24 2016 14:43
cool that's my guess as well
Joe Baines-Holmes
May 24 2016 16:16
It'll work with imread if I pass multifile=False as an argument. I'm not sure if this means the problem is with the metadata itself or