Re: Increasing macro routine efficiency
Posted by
Ben.BigHair on
Oct 24, 2006; 1:37pm
URL: http://imagej.273.s1.nabble.com/Increasing-macro-routine-efficiency-tp3701246p3701247.html
Joaquin Soriano wrote:
> I have built a very large macro and know I'm thinking about increasing his
> efficiency by reducing his executing time. This macro combines series of
> images and always gives a result window, I think that I could reduce the
> macro executing time if I could tell the program not to show me any image
> but the last one. The fact is that I don't have any idea about programming
> (I built the macro using the plug in "Macro Record"), but it looks intuitive
> that the PC "expends time" creating this "intermediary images" and that I
> could save time if this images were not created. Am I right? , How can be
> that done?
>
>
>
> For example, if I had to do an XOR between the image stacks 1 and 2 and then
> execute a reconstruct command using the image 1 as mask and the result of
> the XOR as seed, the macro written by the Macro recorder will be this:
>
>
>
> imageCalculator("XOR create stack", "1.tif","2.tif");
>
> //run("Image Calculator...", "image1=1.tif operation=XOR image2=2.tif create
> stack");
>
> run("BinaryReconstruct ", "mask=1.tif seed=[Result of 1.tif] create white");
>
>
>
> Then, I would have four stacks as a result of executing this macro: the
> original ones ("1.tif" and "2.tif"), the resulting stack ("Reconstructed")
> and the stack "Result of 1.tif". I'm not interested in the stack "Result of
> 1.tif" and I think that creating this image is a waste of time. Can I modify
> the "macro code" somehow, in order to avoid creating this stack?
>
>
>
> PS: if any one has any idea about how to optimize the macros running time,
> please let me know, all suggestions are welcome.
>
>
>
> Thank you very much in advance.
>
>
Hi,
I'm not clear on the importance of creating the stack as a result of the
calculation, but there is a nice option in the macro language
"setBatchMode" which, went set, greatly speeds things along. You might
give that a try.
Cheers,
Ben