Antwort: java for loop

Posted by Joachim Wesner on
URL: http://imagej.273.s1.nabble.com/java-for-loop-tp3702431p3702432.html

Hi Roberto

some small points here:

You are talking Macro here it seems, Macro language is not really/fully
Java, superfluous to define variables at all in many cases, try

for(i=1;i<=roiManager("count");i++) {

You will also need <= not = for the comparison.

To build the name string, concat strings and numbers with "+"

roiManager("Rename","a"+i+"n");

Have you looked up the docs at

http://rsb.info.nih.gov/ij/developer/macro/macros.html ???

Hope this helps!



                                                                                                                                         
                      roberto aranibar                                                                                                  
                      <robertoaranibar@H         An:      [hidden email]                                                            
                      OTMAIL.COM>                Kopie:                                                                                  
                      Gesendet von:              Thema:   java for loop                                                                  
                      ImageJ Interest                                                                                                    
                      Group                                                                                                              
                      <[hidden email]                                                                                                
                      OV>                                                                                                                
                                                                                                                                         
                                                                                                                                         
                      23.06.2006 23:25                                                                                                  
                      Bitte antworten an                                                                                                
                      ImageJ Interest                                                                                                    
                      Group                                                                                                              
                                                                                                                                         




I am a fairly experienced Matlab programmer, but I have no experience with
Java and all I want to do is write a simple macro that does a for loop in
it
which renames all the ROIs in my ROI manager as

"a{the number of the roi in the list (i.e., "13" if its the 13th roi in the

list)}n"

this is what I have so far, but the macros > evaluate line command in the
imageJ text editor says that my integer i is undefined:

for(int i=1;i=roiManager("count");i++) {
roiManager("Select",i-1);
roiManager("Rename","a"i"n");
}

I'm also unsure about the syntax used to insert the integer i into my
string.

Can anyone help or point me to a good reference? Thanks so much, Roberto

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________