Login  Register

Re: Increasing running times - Versatile Wand plugin

Posted by Michael Schmid on Apr 10, 2015; 5:07pm
URL: http://imagej.273.s1.nabble.com/Increasing-running-times-Versatile-Wand-plugin-tp5012433p5012435.html

Hi Avital,

hmm, I can't reproduce this. With the image in your attachment, I always get about 5.5 to 6 seconds on my computer, independent on how often I run it.
CPU: 2.4 GHz Core2 Duo; plain ImageJ 1.49q, but that should not matter; 64-bit Java 1.6.0_65.

Do you get the same result if you take the JPG from the list? JPG is a lossy compression, so it changes the pixel values. Also it is only 8 bits and does not keep the calibration, if any (the Versatile Wand uses the pixel value calibration).

The speed of the Versatile Wand with gradient tolerance strongly depends on the image data (it uses a very simple queue-based flood fill algorithm), so you may experience some change in computing time with successive smoothing of the image. I tried converting the image to 16 bits and multiplying the image values by various numbers, and saw that it becomes slower for some values. The maximum I have ever seen was 25 seconds for the 10 'WANDS' selections. This was with to a very "fractal" selection. It never seemed to hang. You should also see the progress bar in the ImageJ panel running, even if it is slow.

Michael
________________________________________________________________
On Apr 10, 2015, at 18:24, Avital Steinberg wrote:

> Hi,
> I'm running an imageJ macro that calls the Versatile Wand plugin and uses
> it 10 times per image. I manually open an image such as the attached image,
> then run the following code:
>
> run("Gaussian Blur...", "sigma=2");
> WANDS           = newArray(75, 10, 50, 20, 30,35, 76,90,105,0);
> run("Set Scale...", "global");
> start = getTime();
> for(wandValue=0; wandValue < WANDS.length-1; wandValue++){
>    run("Versatile Wand", "value="+WANDS[wandValue]+" color=-100
> gradient="+10+" connectedness=4-connected x="+780+" y="+780+" do");
> }
> end = getTime();
> itTook = (end - start)/1000;
> print("Running time: " + itTook);
>
> And then manually close the image. The first time I ran it, it took 11.028
> seconds, the second time: 22.782 seconds, the third time: 38.631, and the
> fourth time - it ran so slowly that I had to kill it. It always happens
> like this and I have to restart Fiji in order to be able to continue
> running my macro on additional images.
>
> What might the problem be? (I'm running it on a mac 10.9.5)
>
> Thank you,
> Avital

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html