Login  Register

Reloading/Reverting a stack

Posted by Juanjo Vega on Sep 27, 2010; 3:30pm
URL: http://imagej.273.s1.nabble.com/Reloading-Reverting-a-stack-tp3686773.html

Hi everyone,

I'm trying to implement a timer which will reload an image from disk
every period (5 seconds). It will be used to check images while they are
being modified by other programs.

As a quick trick, I'm using the "Revert" command inside the timer's
"run()" method, and it seems to work for 2D images, but it doesn't work
for stacks.

I also tried this:

FileInfo fi = imp.getOriginalFileInfo();
FileOpener fo = new FileOpener(fi);
fo.revertToSaved(imp);

But the stack is not reverted. And if I use the "getFileInfo()" method
instead of "getOriginalFileInfo()", it crashes because of some kind of
internal casting between byte and float:

"Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [F
cannot be cast to [B"

Right now I'm sort of ideas, so I'm having a look into manuals and the
internet, but maybe somebody could help me.

Sincerelly,

Juanjo Vega.