CONTENTS DELETED
The author has deleted this message.
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512 Hello, your code works ok. The problem is the way you try to run it. I suppose you try to run it from the macro editor. You can do this when you have no macro definition or one macro definition in the file. If you have multiple macro definitions the first defined macro will be executed. So whenever you run your code from the macro editor, macro1 will be executed. Macro files with multiple macro definitions are usually installed and the different macros can then be run from the menu Plugins>Macros. I guess you do not want to have macro1 and macro2 accessible from the menu so you might want to use functions instead of macro definitions: function loadChamberTwoROIs() { print("macro2") roiManager("Open", "C:\\Users\\310168723\\Documents\\ImageJ_cases\\20140710_Fluorescence\\ROI\\ROI3_spots.roi"); roiManager("Show All"); roiManager("Select", newArray(0)); roiManager("Measure"); } and function loadChamberOneRois() { .... } You would then replace run("macro1"); in your if statement by the function call loadChamberOneRois(); Volker [hidden email]: > I have two types of data files. In the filename of the data file is > mentioned whether it is chamber #1 (ch1) or chamber #2 (ch2). For > the chambers is a different ROI area defined. I tried to make a > macro in ImageJ; unfortunately I didn't succeed in it. Could you > guys help me out? > > > MACRO TEXT: > > macro "macro1" { print("macro1"); roiManager("Open", > "C:\\Users\\310168723\\Documents\\ImageJ_cases\\20140710_Fluorescence\\ROI\\ROI3_above_PIN.roi"); > > > roiManager("Open", > "C:\\Users\\310168723\\Documents\\ImageJ_cases\\20140710_Fluorescence\\ROI\\ROI3_right_upper.roi"); > > roiManager("Open", > "C:\\Users\\310168723\\Documents\\ImageJ_cases\\20140710_Fluorescence\\ROI\\ROI3_spots.roi"); > > roiManager("Show All"); > roiManager("Select", newArray(0,1,2,3)); roiManager("Measure"); } > > macro "macro2" { print("macro2") roiManager("Open", > "C:\\Users\\310168723\\Documents\\ImageJ_cases\\20140710_Fluorescence\\ROI\\ROI3_spots.roi"); > > roiManager("Show All"); > roiManager("Select", newArray(0)); roiManager("Measure"); } > > chamber=substring(filename, lengthOf(filename) - 10, > lengthOf(filename) - 7); print(chamber); > > if (chamber=="ch1") { run("macro1"); } else if (chamber=="ch2") { > run("macro2"); } > > > > -- View this message in context: > http://imagej.1557.x6.nabble.com/IF-ELSE-and-two-different-ROI-areas-tp5008862.html > > > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJTz+o3AAoJENcVU956o58Na+EH/jcZhdu6N0Jze2OXi1w7VwCI U3a9SF8CM72xErCmFT5Xng7yES2oBrOAYNlxOapNMnyIXbX3886A1nqQKoS4wDuz YLaR10jv8gcbZLdm28vKs3vlGXXYAkFrd0HOD4H3+eM/BsSUjcaJNVXqxRm8BssU xFwgrs0h80DV+qpn9fqyHNce62bDy8KSyQBYMRfU7oHhdv0pjbJ2Jv2Tn9Jbu9eA CVL8cBsrBXdEjA09NH3YQwew0PWTrJfU7h57OeJ/wPJx7VYTJCi9YQtnji/laA+n jgmRxEQRZkAbW7gUG9pEO3oIvU5ugn79vrzOSieuII8rspqP3KcBmVClxQqLgzE= =JRAV -----END PGP SIGNATURE----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
CONTENTS DELETED
The author has deleted this message.
|
Free forum by Nabble | Edit this page |