Re: Weird macro behaviour

Posted by Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/Weird-macro-behaviour-tp5011475p5011525.html

On Feb 9, 2015, at 5:43 AM, Straatman, Kees (Dr.) <[hidden email]> wrote:
>
> Dear Anália,
>
> That is correct. I get in all cases the merged image, both using ImageJ (ImageJ 1.49o, Java 1.7.0_71 (32-bit), Windows 7) or Fiji (ImageJ 1.49m, Java 1.6.0_24 (64-bit), Windows 7) running the code:

This is probably a race condition that you can work around by adding

    run("From ROI Manager”);

just before

    run("Flatten”);

The Image>Overlay>From ROI Manager command adds the ROI Manager’s "Show all without labels” overlay to the end of the standard overlay.

-wayne

> macro test{
> //open("51_FA_65_5.tif (green)-1.tif");
>
> open("Z:\\tmp\\smalltest\\51_FA_65_5.tif (green)-1.tif");
> title=getTitle();
>
> run("Analyze Particles...", "size=0-500 circularity=0-1 show=Nothing add"); // size and circularity parameters
>
> roiManager("Show all without labels");
> run("Colors...","selection=magenta");
>
> //open("51_FA_65_5.tif");
> open("Z:\\tmp\\smalltest\\51_FA_65_5.tif");
> original=getTitle();
> print(">>>>O: "+original);
>
> //saveAs("Tiff",out+"/"+original);
>
> selectImage(1);
> roi=getTitle();
> print(">>>>R: "+roi);
>
> run("Add Image...","image="+original);
> run("Flatten");
>
> saveAs("Tiff","Z:\\tmp\\smalltest\\roi_Run.tif");
>
> run("Close");
> run("Clear Results");
>
> close();
>
>
> }
>
> As far as I can see that is your original code.
>
> Can you try a different computer and see if it solves the problem? I would not expect a change to Windows 8 causing this..
>
> Kees
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of analia
> Sent: 06 February 2015 19:38
> To: [hidden email]
> Subject: Re: Weird macro behaviour
>
> Dear Kees,
>
> so that we are clear: you get the  roi.tif <https://drive.google.com/file/d/0B3yFlb9_8aVZcWlMMU9YMU1CRHM/view?usp=sharing>
> image (as shown in the sample data) in both execution approaches. Is this correct?
>
> Because what I get if I do Macros > Install or Macro > Run is the  original image <https://drive.google.com/file/d/0B3yFlb9_8aVZMGJKTnpmMlN3aTA/view?usp=sharing>
> as result of the overlay, it is like the roi image gets replaced rather than overlayed.
>
> I have tried countless variations of the procedure, changed directories (to prevent any issues with spaces and encoding characters)... and, as I told you before, when I comment the Add Image... command, I do get the "simple"
> <a href=&quot;http://&lt;a
> href=&quot;https://drive.google.com/file/d/0B3yFlb9_8aVZamEzQ0NBR2RNWVE/view?usp=sharing&quot;>">roi
> image  saved correctly.
> It seems like there is some sort of bug/issue with this command. I really don't know what else to do :-(
>
> Could it be an issue with my OS (Windows 8.1 64 bits), ImageJ version
> (1.49n) or Java version (1.8.0_25)?
> If you which I can prepare a step by step documentation (snapshots) of me running the macro...
>
> Many thanks,
> Anália
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Weird-macro-behaviour-tp5011475p5011494.html
> Sent from the ImageJ mailing list archive at Nabble.com.


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