ilastik / lazyflow

lazy parallel ondemand zero copy numpy array data flows with caching and dirty propagation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpMultiArrayStacker in need of refactoring (inefficient and buggy)

burgerdev opened this issue · comments

When I was looking at the test cases for the ilastik thresholding applet, I fell over one test case which checked if a non-existent channel index would be interpreted as 0. This test case passed, even though we removed the hack-channel mechanism which was doing exactly that.

It turns out that OpMultiArrayStacker simply does not fill the result with meaningful values when the input is not ready. I.e., the operator returns from the request with a randomly filled volume. Was there a reason for this to be implemented in that particular way?

Furthermore, we could use a request pool instead of a for-loop here. Offending code (generic.py, l. 350 ff):

        requests = []
        for i, inSlot in enumerate(self.inputs['Images']):
            if inSlot.ready():
                # ....
                # actual stacking takes place
                # ....

                if req is not None:
                    requests.append(req)

                # NOTE: NO ELSE!

        for r in requests:
            r.wait()