# speed and ROIs

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## speed and ROIs

 I am trying to speed up a macro that includes working repeatedly with a large stack. I assumed that if I operated on a selection and ran a filter, that the filter would only operate on the selection and would therefore be faster than using the whole stack. However when I checked the timings using they were almost identical. While it is reasonable that a selection only limits the volume operate on, it would be helpful if this translated into an increase in  the speed newImage("play", "8-bit random", 256, 256, 64); makeRectangle(103, 77, 31, 31); t0=getTime(); run("Gaussian Blur...", "sigma=2 stack"); t1=getTime(); print('time with selection',t1-t0,' msecs'); run("Select None"); t2=getTime(); run("Gaussian Blur...", "sigma=2 stack"); t3=getTime(); print('time without selection',t3-t2,' msecs'); It occurred to me that Duplicating the volume of the selection and then filtering that would be faster, since Duplicate is fast newImage("play", "8-bit random", 256, 256, 64); t0=getTime(); run("Gaussian Blur...", "sigma=2 stack"); t1=getTime(); print('Gau whole stack ',t1-t0,' msecs'); newImage("play2", "8-bit random", 256, 256, 64); t2=getTime(); makeRectangle(103, 77, 11, 11); run("Duplicate...", "duplicate"); t3=getTime(); run("Gaussian Blur...", "sigma=2 stack"); t4=getTime(); print('Duplicate ',t3-t2,' msecs'); print('Gau with duplicated selection ',t4-t3,' msecs'); but while duplicate is fast, the time taken for the Gaussian was only marginally reduced. Which seems strange given that the size of the duplicated image is tiny compared to the original. What am I missing ? Jeremy Adler -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Open this post in threaded view
|
Report Content as Inappropriate

## Re: speed and ROIs

 On Friday, 7 July 2017 08:05:19 BST you wrote: > I am trying to speed up a macro that includes working repeatedly with a > large stack.  I assumed that if I operated on a selection and ran a filter, > that the filter would only operate on the selection and would therefore be > faster than using the whole stack. > However when I checked the timings using they were almost identical. > > While it is reasonable that a selection only limits the volume operate on, > it would be helpful if this translated into an increase in  the speed It is twice as fast in my machine when the image is larger (e.g. 1256x1256). I seem to remember that some filtering in IJ is done in multiple threads. Could that make a difference? Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html