Example #1
0
    futures = LinkedList()

    for filename in filenames:
        futures.add(exe.submit(Load(os.path.join(src, filename))))

    stack = ImageStack()

    count = 0
    impStack = None

    while not futures.isEmpty():
        #
        if Thread.currentThread().isInterrupted():
            print "Interrupted"
            break
        #
        imp = futures.removeFirst().get()
        stack.addSlice("", imp.getProcessor())

        if not impStack:
            # Show it right away with the first slice, will update dynamically
            impStack = ImagePlus(os.path.basename(src), stack)
            impStack.show()

        count += 1
        print "Loaded %i/%i" % (count, len(filenames))
        impStack.repaintWindow()

finally:
    exe.shutdownNow()