ilastik/lazyflow

[OpArrayCache] stuff going wrong during report generation

burgerdev opened this issue · 2 comments

@thorbenk (git blame result)

Generation of cache reports fails when block shapes are tuples and not ndarrays because they do not support arithmetic operations. Furthermore, the function in which the error occurs does seem to calculate the actual block shape wrong and does not return a value.

OpArrayCache.py @ line 102:

def _blockShapeForIndex(self, index):
    if self._cache is None:
        return None
    cacheShape = numpy.array(self._cache.shape)
    blockStart = index * self._blockShape
    blockStop = numpy.minimum(blockStart + self._blockShape, cacheShape)

Should be something like:

def _blockShapeForIndex(self, index):
    if self._cache is None:
        return None
    cacheShape = numpy.array(self._cache.shape)
    blockShape = numpy.array(self._blockShape)
    blockStart = index*blockShape  # ??? possibly incorrect
    blockStop = numpy.minimum(blockStart + blockShape, cacheShape)
    return blockStop - blockStart  # correct return value?

Weird that there was no return, how did this ever work at all?

I guess it never worked as intended ;)