Hello.
I'm using the save XY coords on a stack of images in a macro and it works fine but only for a single stack. I'm trying to do a batch job since I have 25000 images per test so splitting the images into groups of 100 or so. Everything seems to be working fine (i don't get any error messages) but the XY coord command doesn't seem to like being given a Variable as its file location so doesn't write any ouput file on each loop of the macro. Any ideas. Am i missing something obvious. Thanks in advance for any help. Heres my macro......... .............................................................. for (n=0; n<1; n++) { run("Image Sequence...", "open=C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\IMAGES\\NECESSARY\\Imag e00000.bmp number=10 starting="+(n*100)+2+" increment=1 scale=100 file="); makeRectangle(20, 150, 680, 250); run("Crop"); for (i=1; i<=nSlices; i++) { run("Set Slice...", "slice="+i); run("8-bit"); run("Min...", "value=100"); setThreshold(240, 255); run("Threshold", "thresholded remaining black"); } setThreshold(240, 255); run("Threshold", "stack"); run("Skeletonize", "stack"); //This works but will just overwrite NECESSARY.txt each time run("Save XY Coordinates...", "process save=C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\NECESSARY.txt"); LABEL0="C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\"; LABEL1="Sequence"+n; LABEL2=LABEL0+LABEL1; LABEL3=LABEL2+".txt"; // Prints Something Like C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\Sequence#(loop number).txt print(LABEL3); //Trying to save XY Coords on each loop of the macro. run("Save XY Coordinates...", "process save=LABEL3"); } |
You have to use string concatenation (the "+" operator) to pass
variables to commands called using the run() function. There is an example at http://rsb.info.nih.gov/ij/macros/ArgumentPassingDemo.txt -wayne On Apr 13, 2006, at 6:57 AM, Brian Sellar wrote: > Hello. > > I'm using the save XY coords on a stack of images in a macro > and it works fine but only for a single stack. I'm trying to > do a batch job since I have 25000 images per test so > splitting the images into groups of 100 or so. Everything > seems to be working fine (i don't get any error messages) > but the XY coord command doesn't seem to like being given a > Variable as its file location so doesn't write any ouput > file on each loop of the macro. Any ideas. Am i missing > something obvious. Thanks in advance for any help. > > Heres my macro......... > > > .............................................................. > > for (n=0; n<1; n++) { > > run("Image > Sequence...", > "open=C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\IMAGES\\NECESSARY\\Imag > e00000.bmp number=10 starting="+(n*100)+2+" increment=1 scale=100 > file="); > > makeRectangle(20, 150, 680, 250); > run("Crop"); > > for (i=1; i<=nSlices; i++) { > run("Set Slice...", "slice="+i); > run("8-bit"); > run("Min...", "value=100"); > setThreshold(240, 255); > run("Threshold", "thresholded remaining black"); > } > > setThreshold(240, 255); > run("Threshold", "stack"); > run("Skeletonize", "stack"); > > //This works but will just overwrite NECESSARY.txt each time > run("Save XY Coordinates...", "process > save=C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\NECESSARY.txt"); > > LABEL0="C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\"; > LABEL1="Sequence"+n; > LABEL2=LABEL0+LABEL1; > LABEL3=LABEL2+".txt"; > // Prints Something Like > C:\\BGS\\FOOTAGE\\BGSTEST2VIDEO\\JPEGRESULTS\\Sequence#(loop > number).txt > print(LABEL3); > > //Trying to save XY Coords on each loop of the macro. > > run("Save XY Coordinates...", "process save=LABEL3"); > > } > |
Free forum by Nabble | Edit this page |