Posted by
Edoukoua Konin on
Apr 16, 2015; 1:06pm
URL: http://imagej.273.s1.nabble.com/Progress-bar-during-resizing-tp5012480p5012506.html
hello, i have needs for assistance, I have a particle that is trapped and I want to extract the different positions, then remove the noises. KONIN EDOUKOUA JEAN MICHEL
DOCTORANT
Université Nangui AbrogouaInstitut National
Polytechnique de Yamoussoukro
+225 49036815/ +225 46250179+225 21276241
Le Mercredi 15 avril 2015 17h24, Michael Schmid <
[hidden email]> a écrit :
Hi Nico,
sorry, you can't get the progress of a resize operation from outside the ImageProcessor method that does the job.
One could have a parallel thread with that shows just some progress bar with arbitrary speed, and terminates if the operation is done, but a solution with macros only will be a rather tricky hack.
It is easier with a plugin than with a macro for the progress bar, because then one could stop it via a 'call' command. I have written a quick and dirty one, below. After 'Compile&Run', you have to do "Refresh Menus" to make it appear somewhere in the Plugins menu, then you can start it in a separate thread with doCommand.
Michael
________________________________________________________________
import ij.*;
import ij.plugin.PlugIn;
/** Displays a progress bar with fixed speed.
* It can be started in a separate thread from a macro with
* doCommand("Asynchronous Progress Bar");
* To make it disappear, use the following macro command:
* call("Asynchronous_Progress_Bar.stop");
* To set the maximum time to 50 sec,
* call("Asynchronous_Progress_Bar.setMaxTime", 50);
*
* 2014-04-15 Michael Schmid
*/
public class Asynchronous_Progress_Bar implements PlugIn {
static boolean stop;
static double maxTime = 100; //default 100 sec
public void run(String arg) {
stop = false;
for (int i=0; i<99; i++) {
if (stop) {
IJ.showProgress(1.0);
break;
}
IJ.showProgress(i, 100);
IJ.wait((int)(10*maxTime));
}
}
public static void setMaxTime(String timeString) {
try {
maxTime = Double.parseDouble(timeString);
} catch (Exception e) {}
}
public static void stop() {
stop = true;
IJ.showProgress(1.0);
}
}________________________________________________________________
On Apr 15, 2015, at 18:10, Nicolas Brouilly wrote:
> Hi Michael !
>
> Thank you for your clarifications !
>
> Is there any chance that, in a macro, one can display a "progress bar" in the log window using parallel threads ? Or any other way to get an idea about the progress of a resizing step in a macro ?
>
> Thanks !
>
> Nico
>
> On 15/04/2015 17:13, Michael Schmid wrote:
>> Hi Nico,
>>
>> ImageJ shows the progress bar only for some operations, mainly for those that are slow with more "typical" image sizes (0.1-10 Mpixels). Your output image has 100 Mpxl.
>>
>> Resizing is done at a rather low level (ImageProcessor) and it is just a small part of the operation in several other commands (e.g. "Make Montage"), so adding a progress bar for resizing would give a meaningless (or flickering) progress bar for other operations that use resizing. So ImageJ just shows a status message when resizing, counting the images that have to be resized (for the case that a stack is resized). Unfortunately, that status message goes away as soon as the mouse is moved over an image, it yields for the coordinates & value readout.
>>
>> Michael
>> ________________________________________________________________
>> On Apr 15, 2015, at 16:17, Nicolas Brouilly wrote:
>>
>>> Dear all,
>>>
>>> How can I get the progress bar to appear during a resizing manipulation ?
>>>
>>> Let say that you have a 1 000 x 1 000 px image and want to resize it to 10 000 x 10 000 px. It takes more than a second (20 seconds on my system), though the progress bar does not appear.
>>>
>>> Is there a limited list of functions for which the progress bar is supposed to appear ?
>>>
>>> Thanks !
>>>
>>> Nico
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
>
> Nicolas BROUILLY, PhD
>
> Zerial lab,
>
> Max Planck Institute of Molecular
>
> Cell Biology and Genetics
>
> Pfotenhauerstr. 108
>
> 01307 Dresden
>
> phone: +49 351 210-2489
>
> e-mail:
[hidden email]
>
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html