Вопрос

I'm having trouble with an ImageJ macro. Functions selectImage(id) and selectWindow(name) are causing ImageJ to crash completely, even so that I have to reset Unity altogether (I'm on Ubuntu 12.04), since all GUI input just freezes.

The macro in which this happens is rather long. When I use the aforementioned functions in short and simple macros nothing happens. I first open the images, then perform some thousands of operations, and then request the window switch. That's when the whole thing freezes.

Is anyone familiar enough with these so as to suggest what might be the problem?

Это было полезно?

Решение

If you prefix your macro with setBatchMode(true) then ImageJ will execute the macro in the background, not displaying or updating any windows until the macro is complete (or until setBatchMode(false) is called). This will prevent selectWindow and selectImage calls from actually bringing windows to the foreground, and in your case crashing Unity. Your macro will also be orders of magnitude faster.

Другие советы

I found the solution as I wrote the question. The problem was that I was calling selectImage() and selectWindow() inside a loop, which was resulting in thousands of window switch requests per second. I guess Unity can't handle that very well.

Bottom line: don't call those functions inside a long loop.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top